On 24 May 2011 15:35, Claves Do Amaral <[email protected]> wrote:
> Hello to the Maven users.
>
> I am trying to generate two artefacts, each containing two different flavours
> of generated classes.
> I am able to generate the classes under two different folders:
>
> target\generated-sources-jacorb
> target\generated-sources-sunorb
>
> Now I would like to compile these two folders separately in the same build,
> and include them in two different artefacts.
One pom -> one artifact
to create two artifacts, use a multi-module project.
Anything else is a hack that will end in tears... and it's far far far
quicker to just do it the right way... if you don't like the right way
might I suggest ANT or any other number of procedural build tools that
you can bend to your will and then 3 years later when you come back to
the project you can spend five weeks tearing out your hair trying to
figure out what exactly you did and why ;-)
> I am using the following configuration, with two executions
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <executions>
> <execution>
> <id>compile-with-jacorb</id>
> <goals>
>
> <goal>compile</goal>
> </goals>
> <configuration>
>
> <outputDirectory>${project.build.directory}/classes-jacorb</outputDirectory>
> <excludes>
>
> <exclude>**/generated-sources-sunorb/*</exclude>
> </excludes>
> </configuration>
> </execution>
> <execution>
> <id>compile-with-sunorb</id>
> <goals>
>
> <goal>compile</goal>
> </goals>
> <configuration>
>
> <outputDirectory>${project.build.directory}/classes-sunorb</outputDirectory>
> <excludes>
>
> <exclude>**/generated-sources-jacorb/*</exclude>
> </excludes>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
> however the compilation fails with the error
>
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile
> (default-compile) on project test-attach-artifact: Compilation failure:
> Compilation failure:
> [ERROR]
> \dev\Projects\test-attach-artifact\target\generated-sources-jacorb\idl\uk\co\igindex\corba\service\V3_0\NoDataHelper.java:[11,13]
> duplicate class: uk.co.igindex.corba.service.V3_0.NoDataHelper
> ..........
>
> I.e. both generated source folders are included during compilation. I can see
> this in the maven output:
>
> [DEBUG] Configuring mojo
> 'org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile' with basic
> configurator -->
> [DEBUG] (f) basedir = C:\dev\Projects\test-attach-artifact
> [DEBUG] (f) buildDirectory = C:\dev\Projects\test-attach-artifact\target
> [DEBUG] (f) classpathElements =
> [C:\dev\Projects\test-attach-artifact\target\classes]
> [DEBUG] (f) compileSourceRoots =
> [C:\dev\Projects\test-attach-artifact\src\main\java,
> C:\dev\Projects\test-attach-artifact\target\generated-sources-jacorb\idl,
> C:\dev\Projects\test-attach-artifact\target\generated-sources-sunorb\idl]
> ......
>
> However, looking at the first part of the output (before the above excerpt),
> it looks the configuration is picked up
>
> [DEBUG] Goal:
> org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile
> (compile-with-jacorb)
> [DEBUG] Style: Regular
> [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
> <configuration>
> <basedir default-value="${basedir}"/>
> <buildDirectory default-value="${project.build.directory}"/>
> <classpathElements default-value="${project.compileClasspathElements}"/>
> <compileSourceRoots default-value="${project.compileSourceRoots}"/>
> <compilerId default-value="javac">${maven.compiler.compilerId}</compilerId>
> <compilerVersion>${maven.compiler.compilerVersion}</compilerVersion>
> <debug default-value="true">${maven.compiler.debug}</debug>
> <debuglevel>${maven.compiler.debuglevel}</debuglevel>
> <encoding
> default-value="${project.build.sourceEncoding}">${encoding}</encoding>
> <excludes>
> <exclude>**/generated-sources-sunorb/*</exclude>
> </excludes>
> .........
>
> and
>
> [DEBUG] Goal:
> org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile
> (compile-with-sunorb)
> [DEBUG] Style: Regular
> [DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
> <configuration>
> <basedir default-value="${basedir}"/>
> <buildDirectory default-value="${project.build.directory}"/>
> <classpathElements default-value="${project.compileClasspathElements}"/>
> <compileSourceRoots default-value="${project.compileSourceRoots}"/>
> <compilerId default-value="javac">${maven.compiler.compilerId}</compilerId>
> <compilerVersion>${maven.compiler.compilerVersion}</compilerVersion>
> <debug default-value="true">${maven.compiler.debug}</debug>
> <debuglevel>${maven.compiler.debuglevel}</debuglevel>
> <encoding
> default-value="${project.build.sourceEncoding}">${encoding}</encoding>
> <excludes>
> <exclude>**/generated-sources-jacorb/*</exclude>
> </excludes>
> .......
>
> Therefore, I do not understand why the configuration is loaded and then
> discarded. If someone could help me, I would really appreciate.
>
> Thanks
>
> Claves
>
> ________________________________
> The information contained in this email is strictly confidential and for the
> use of the addressee only, unless otherwise indicated. If you are not the
> intended recipient, please do not read, copy, use or disclose to others this
> message or any attachment. Please also notify the sender by replying to this
> email or by telephone (+44 (0)20 7896 0011) and then delete the email and any
> copies of it. Opinions, conclusions (etc) that do not relate to the official
> business of this company shall be understood as neither given nor endorsed by
> it. IG Group Holdings plc is a company registered in England and Wales under
> number 01190902. VAT registration number 761 2978 07. Registered Office:
> Cannon Bridge House, 25 Dowgate Hill, London EC4R 2YA. Authorised and
> regulated by the Financial Services Authority. FSA Register number 114059.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]