You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Claves Do Amaral <Cl...@iggroup.com> on 2011/05/24 16:35:29 UTC

How to compile twice

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.
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.

RE: How to compile twice

Posted by Claves Do Amaral <Cl...@iggroup.com>.
-----Original Message-----
From: Laird Nelson [mailto:ljnelson@gmail.com]
>
>How about:
>
><excludes>
>  <exclude>../../generated-sources-jacorb/**</exclude>
>  <exclude>../../generated-sources-sunorb/**</exclude>
></excludes>

I have downloaded the Plexus compiler source code (which is what ultimately maven-compiler-plugin 2.3.2 uses) and it looks that there is no solution with <excludes>. The filter won't work in this case. Also, the compileSourceRoot is a read-only property (possibly to force developers to modify it only through a plugin and not configuration?). Therefore, I don't see a clean solution apart from fixing my own idl plugin.

I will add a property addOutputFolerToCompileSourceRoot to configure in the pom. This looks the best solutions, unless someone has a better idea.

Thank you Laird,

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.

Re: How to compile twice

Posted by Laird Nelson <lj...@gmail.com>.
On Wed, May 25, 2011 at 10:26 AM, Claves Do Amaral <
Claves.DoAmaral@iggroup.com> wrote:

> <excludes>
>
>  <exclude>${project.build.directory}/generated-sources-sunorb/idl/**/*.java</exclude>
> </excludes>
>
> Does not have any effect since the excludes start from the source root,
> i.e. it's a filter that is applied to the subtree
>
> ...\target\generated-sources-jacorb\idl\uk\co\....
>
> but starting at uk.co.... i.e. it ignores the path up to .. \idl itself.
>

{holds nose}

How about:

<excludes>
  <exclude>../../generated-sources-jacorb/**</exclude>
  <exclude>../../generated-sources-sunorb/**</exclude>
</excludes>

:-)

I have no idea whether that would work or not, and it sure smells bad!

Best,
Laird

RE: How to compile twice

Posted by Claves Do Amaral <Cl...@iggroup.com>.
-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com]
>
>Not much, Maven is very angry about it :-D Anyway, did you try, at least, to see if you can do a multimodule build?

We had multi-module builds but it turned out to be a bit messy.
Now, we switched to profiles plus classifiers, only to realise that at release, only one profile can be activated, i.e. we can release only one flavour of our ORB connector

Another solutions would be releasing forcing the version, s.t. I may be able to release a jacorb artefact, say to version 1.0, and then do another mvn release using the same version 1.0 to release a sunorb artefact. Please, don't shoot the piano player...

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to compile twice

Posted by Antonio Petrelli <an...@gmail.com>.
2011/5/25 Claves Do Amaral <Cl...@iggroup.com>

> -----Original Message-----
> From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> >
> >STOP FIGHTING MAVEN
>
> :)
>
> I will take the risky way, like Prometheus, and pay the consequences of my
> hubris. I hope that Maven will have mercy on me.
>

Not much, Maven is very angry about it :-D
Anyway, did you try, at least, to see if you can do a multimodule build?
If not, what problems are you encountering in this step?

Antonio

RE: How to compile twice

Posted by Claves Do Amaral <Cl...@iggroup.com>.
-----Original Message-----
From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
>
>This is the Maven way.

Ok I will use my copy of "Maven: The Definitive Guide" to light my next BBQ.
You convinced me, I am back to the orthodoxy. Nested Modules.

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to compile twice

Posted by Antonio Petrelli <an...@gmail.com>.
2011/5/25 Ron Wheeler <rw...@artifact-software.com>

> On 25/05/2011 10:58 AM, David McCabe wrote:
>
>> In that case, how does one handle a single module build that produces
>> multiple artefacts? Is this 'not the Maven way'? What about multi-platform
>> builds? What about multiple output types (header files, DLLs, import
>> libraries and JNI JARs)?
>>
>> I'm getting very confused by this, because the 'Maven way' seems to
>> indicate
>> that I should have the following:
>>
>> imaging-core-win32-x86-dll
>> imaging-core-win32-x86-lib
>> imaging-core-win32-x64-dll
>> imaging-core-win32-x64-lib
>> imaging-core-osx-x86-so
>> imaging-core-osx-x64-so
>> imaging-core-linux-glibc22-x86-so
>> imaging-core-jar
>> imaging-core-includes
>> ...
>>
>> as separate *modules* and then build each of these separately, rather than
>> simply building several things with different classifiers. That is a
>> nightmare. Maven must surely be suitable for more than collections of
>> JARs.
>> What have I missed?
>>
> In what sense is this a nightmare?
>  You have to be smart about how you build up your application but in the
> end you have a neat structure that is easy to maintain since all of the
> Win32-x86 code is in one place and the windows version maintainer/developer
> does not have to worry about the core and includes since they are generic
> and can not break the linux or osx versions accidently.
>

I disagree here.
The concept of "architecture" is well established in the native compilation
world. This is a thing that Maven does not understand, at least "natively".
IMHO the classifier could be used in this use case, and it is in fact used,
for example, in maven-retrotranslator-plugin to provide Java 1.4-compatible
packages of the same artifact.

Antonio

RE: How to compile twice

Posted by Claves Do Amaral <Cl...@iggroup.com>.
-----Original Message-----
From: anders.g.hammar@gmail.com [mailto:anders.g.hammar@gmail.com] On Behalf Of Anders Hammar
>
>Possibly, but very much not the Maven way IMHO. You should never have to do more than one build! If you were using a repo manager which correctly blocks >redeploys, you would get an error the second time as the pom would be re-deployed.
>
>/Anders

I am really sorry Anders, but I have possibly missed to explain exactly what my problem is and my needs are in this specific case. My case is more similar to those outlined by David McCabe and Benson Margulies who posted earlier in the same thread (BTW, I forgot to say thank you to Benson for the hint on the deploy:deploy command to deploy different artifacts).

What I am trying to do here is not to build twice, but avoid to do so! In fact, I have two completely different sets of generated sources that need to be compiled to generate two artifacts with two classifiers: myArtifact-jacorb and myArtifact-sunorb. The submodules idea simply did not work.

The point is that despite Maven is a very useful tool, it is not very flexible. In fact, it looks that as soon as one has to deal with something slightly different from a standard WAR/JAR project he runs into troubles.

I think profiles and classifiers are tools that have been introduced to add that bit of flexibility that a non-standard maven user needs in order to accomplish his tasks. You say this is the non standard way to do with Maven, and I trust you, but this is the only simple way I have managed to make my project working well. The produced POM is all but cumbersome, it's clear and short, and I did not miss to add a couple of comments to help other developers to maintain it.

I pay tribute to the Maven way of doing things, but in this case, like Frank Sinatra, "I did it my way".

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to compile twice

Posted by Anders Hammar <an...@hammar.net>.
On Fri, May 27, 2011 at 16:14, Claves Do Amaral <Claves.DoAmaral@iggroup.com
> wrote:

> -----Original Message-----
> From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> >
> >if it is the exact same source producing multiple artifacts which all have
> the exact same dependencies, then you can be ok... but getting the release
> >deployed becomes tricky. But for JAR/WAR/EAR files multiple artifacts is
> almost never what you want...
>
> This was also our case, indeed.
>
> We solved this doing a release with the default profile, jacorb.
> Then we checkout the so created tag and do a deploy of the sunorb artefact.
>
> Simple....
>

Possibly, but very much not the Maven way IMHO. You should never have to do
more than one build! If you were using a repo manager which correctly blocks
redeploys, you would get an error the second time as the pom would be
re-deployed.

/Anders



>
>
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: How to compile twice

Posted by Claves Do Amaral <Cl...@iggroup.com>.
-----Original Message-----
From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
>
>if it is the exact same source producing multiple artifacts which all have the exact same dependencies, then you can be ok... but getting the release >deployed becomes tricky. But for JAR/WAR/EAR files multiple artifacts is almost never what you want...

This was also our case, indeed.

We solved this doing a release with the default profile, jacorb.
Then we checkout the so created tag and do a deploy of the sunorb artefact.

Simple....


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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to compile twice

Posted by Stephen Connolly <st...@gmail.com>.
On 25 May 2011 23:43, David McCabe <da...@sunlightd.com> wrote:

> > -----Original Message-----
> > From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> > Sent: Wednesday, 25 May 2011 4:54 PM
> > To: users@maven.apache.org
> > Subject: Re: How to compile twice
> >
> > On 25/05/2011 10:58 AM, David McCabe wrote:
> > > In that case, how does one handle a single module build that produces
> > > multiple artefacts? Is this 'not the Maven way'? What about
> > > multi-platform builds? What about multiple output types (header files,
> > > DLLs, import libraries and JNI JARs)?
> > >
> > > I'm getting very confused by this, because the 'Maven way' seems to
> > > indicate that I should have the following:
> > >
> > > imaging-core-win32-x86-dll
> > > imaging-core-win32-x86-lib
> > > imaging-core-win32-x64-dll
> > > imaging-core-win32-x64-lib
> > > imaging-core-osx-x86-so
> > > imaging-core-osx-x64-so
> > > imaging-core-linux-glibc22-x86-so
> > > imaging-core-jar
> > > imaging-core-includes
> > > ...
> > >
> > > as separate *modules* and then build each of these separately, rather
> > > than simply building several things with different classifiers. That
> > > is a nightmare. Maven must surely be suitable for more than collections
> of
> > JARs.
> > > What have I missed?
> > In what sense is this a nightmare?
> >   You have to be smart about how you build up your application but in the
> > end you have a neat structure that is easy to maintain since all of the
> Win32-
> > x86 code is in one place and the windows version maintainer/developer
> does
> > not have to worry about the core and includes since they are generic and
> can
> > not break the linux or osx versions accidently.
>
> Nonsense. This is *one module* ('imaging-core') of many, comprised of about
> a dozen portable C++ source and header files and a dozen Java classes. The
> two go together. The same code gets compiled for at least six targets,
> generating at least eight artefacts (if one counts the header files as a
> single artefact). There is no separate Windows code base. There is no way
> this can be separated into the above module set without duplication.
>
> We have about a dozen of these native modules, which are then consumed by
> 'normal' Java dependents - which need the DLLs (or whatever) to run their
> tests. Is it really the 'Maven way' to inflate this fairly straightforward
> build of a dozen JNI components to a hundred individually versioned
> modules?
>
> The more I investigate Maven, the less it seems that anyone has considered
> using it for anything other than simplistic JAR/WAR/EAR programs or
> scripting languages. C/C++ code inherently produces multiple artefacts per
> module, and portable code generates artefacts that cannot all be generated
> at once. Is Maven not powerful enough to support this?
>
>
if it is the exact same source producing multiple artifacts which all have
the exact same dependencies, then you can be ok... but getting the release
deployed becomes tricky. But for JAR/WAR/EAR files multiple artifacts is
almost never what you want...

you need to be careful that we have to respond with answers for all the
people trying to do crazy stuff with the JAR/WAR/EAR...

in your case the native code is really an essential side artifact for the
main jar, the reality of jars is that you don't package it within the jar
but along side it, and it is inextricably linked to the jar... so for that
case AND I AM ONLY TALKING ABOUT THE CASE OF JNI component libs... attached
is the way to go


> David
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: How to compile twice

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,

> Speaking as someone who builds a gigantic production farm of C++ code
> into (amongst other things), JNI, I'll tell you that we don't use
> maven to build any C++ at all. We Just Use Make, and then we bring the
> appropriate native libs into the maven build for testing. The deploy
> plugin are our friends, A command-line run of deploy:deploy-file from
> a makefile can push a native package into our repository, and and then
>   the maven build to unpacks when needed to run tests or to make
> packages.
>
May be it's worth to take a look at the Maven Nar Plugin 
(https://github.com/duns/maven-nar-plugin) which is intended to build 
C/C++ code ...

Kind regards
Karl Heinz Marbaise
-- 
SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl Heinz Marbaise        ICQ#: 135949029
Hauptstrasse 177                         USt.IdNr: DE191347579
52146 Würselen                           http://www.soebes.de

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to compile twice

Posted by Benson Margulies <bi...@gmail.com>.
Any time you all get tired of insulting each other's intelligence we
can all try to find a solution.

It's a simple fact, Maven was, indeed, designed to build Java. It was
not designed to build C++ or any other native code language. The core
model of what gets built is one output per module.

Features have been added that are intended to help with that. On the
other hand, the core tools to build C++ code sat forlorn for several
years at one point.

Speaking as someone who builds a gigantic production farm of C++ code
into (amongst other things), JNI, I'll tell you that we don't use
maven to build any C++ at all. We Just Use Make, and then we bring the
appropriate native libs into the maven build for testing. The deploy
plugin are our friends, A command-line run of deploy:deploy-file from
a makefile can push a native package into our repository, and and then
 the maven build to unpacks when needed to run tests or to make
packages.

We use the 'classifier' concept to mark artifacts that are
architecture-sensitive. We do not use profiles for architectures, due
to artifact id collisions.

You can use the build helper or the assembly plugin to cause one
module to emit multiple artifacts that differ by a classifier.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: How to compile twice

Posted by David McCabe <da...@sunlightd.com>.
> -----Original Message-----
> From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> Sent: Wednesday, 25 May 2011 4:54 PM
> To: users@maven.apache.org
> Subject: Re: How to compile twice
> 
> On 25/05/2011 10:58 AM, David McCabe wrote:
> > In that case, how does one handle a single module build that produces
> > multiple artefacts? Is this 'not the Maven way'? What about
> > multi-platform builds? What about multiple output types (header files,
> > DLLs, import libraries and JNI JARs)?
> >
> > I'm getting very confused by this, because the 'Maven way' seems to
> > indicate that I should have the following:
> >
> > imaging-core-win32-x86-dll
> > imaging-core-win32-x86-lib
> > imaging-core-win32-x64-dll
> > imaging-core-win32-x64-lib
> > imaging-core-osx-x86-so
> > imaging-core-osx-x64-so
> > imaging-core-linux-glibc22-x86-so
> > imaging-core-jar
> > imaging-core-includes
> > ...
> >
> > as separate *modules* and then build each of these separately, rather
> > than simply building several things with different classifiers. That
> > is a nightmare. Maven must surely be suitable for more than collections
of
> JARs.
> > What have I missed?
> In what sense is this a nightmare?
>   You have to be smart about how you build up your application but in the
> end you have a neat structure that is easy to maintain since all of the
Win32-
> x86 code is in one place and the windows version maintainer/developer does
> not have to worry about the core and includes since they are generic and
can
> not break the linux or osx versions accidently.

Nonsense. This is *one module* ('imaging-core') of many, comprised of about
a dozen portable C++ source and header files and a dozen Java classes. The
two go together. The same code gets compiled for at least six targets,
generating at least eight artefacts (if one counts the header files as a
single artefact). There is no separate Windows code base. There is no way
this can be separated into the above module set without duplication.

We have about a dozen of these native modules, which are then consumed by
'normal' Java dependents - which need the DLLs (or whatever) to run their
tests. Is it really the 'Maven way' to inflate this fairly straightforward
build of a dozen JNI components to a hundred individually versioned modules?

The more I investigate Maven, the less it seems that anyone has considered
using it for anything other than simplistic JAR/WAR/EAR programs or
scripting languages. C/C++ code inherently produces multiple artefacts per
module, and portable code generates artefacts that cannot all be generated
at once. Is Maven not powerful enough to support this?

David


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to compile twice

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 25/05/2011 10:58 AM, David McCabe wrote:
> In that case, how does one handle a single module build that produces
> multiple artefacts? Is this 'not the Maven way'? What about multi-platform
> builds? What about multiple output types (header files, DLLs, import
> libraries and JNI JARs)?
>
> I'm getting very confused by this, because the 'Maven way' seems to indicate
> that I should have the following:
>
> imaging-core-win32-x86-dll
> imaging-core-win32-x86-lib
> imaging-core-win32-x64-dll
> imaging-core-win32-x64-lib
> imaging-core-osx-x86-so
> imaging-core-osx-x64-so
> imaging-core-linux-glibc22-x86-so
> imaging-core-jar
> imaging-core-includes
> ...
>
> as separate *modules* and then build each of these separately, rather than
> simply building several things with different classifiers. That is a
> nightmare. Maven must surely be suitable for more than collections of JARs.
> What have I missed?
In what sense is this a nightmare?
  You have to be smart about how you build up your application but in 
the end you have a neat structure that is easy to maintain since all of 
the Win32-x86 code is in one place and the windows version 
maintainer/developer does not have to worry about the core and includes 
since they are generic and can not break the linux or osx versions 
accidently.
The person working on the core does not have to be concerned about the 
other projects does not even need to check them out of your version 
control system.

This is the Maven way.

 From all the discussion in this forum, profiles appear to be 
intrinsically evil and Maven might be a much better product without them.

Their use should cause a warning during builds
"You appear to be using profiles, please don't. This violates all 
implied or assumed warranties that you think Maven comes with.
You are on the road to damnation and have been warned."

The have a very specific use but everyone who tries to misuse them ends 
up spending hours/days trying to straighten out their heads so they can 
remove them from their POMs.

Ron





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to compile twice

Posted by Stephen Connolly <st...@gmail.com>.
That is a different case, but you still face issues... but for side
artifacts like JNI libs etc, I would be less worried

The case in question is producing just jars

On 25 May 2011 15:58, David McCabe <da...@sunlightd.com> wrote:

> In that case, how does one handle a single module build that produces
> multiple artefacts? Is this 'not the Maven way'? What about multi-platform
> builds? What about multiple output types (header files, DLLs, import
> libraries and JNI JARs)?
>
> I'm getting very confused by this, because the 'Maven way' seems to
> indicate
> that I should have the following:
>
> imaging-core-win32-x86-dll
> imaging-core-win32-x86-lib
> imaging-core-win32-x64-dll
> imaging-core-win32-x64-lib
> imaging-core-osx-x86-so
> imaging-core-osx-x64-so
> imaging-core-linux-glibc22-x86-so
> imaging-core-jar
> imaging-core-includes
> ...
>
> as separate *modules* and then build each of these separately, rather than
> simply building several things with different classifiers. That is a
> nightmare. Maven must surely be suitable for more than collections of JARs.
> What have I missed?
> --
> David
>
> > -----Original Message-----
> > From: anders.g.hammar@gmail.com [mailto:anders.g.hammar@gmail.com]
> > On Behalf Of Anders Hammar
> > Sent: Wednesday, 25 May 2011 3:49 PM
> > To: Maven Users List
> > Subject: RE: How to compile twice
> >
> > It will not. I can tell you that for sure. The person that ends du
> maintaining
> > your build setup will curse your name forever!
> >
> > /Anders (mobile)
> > Den 25 maj 2011 16.44 skrev "Claves Do Amaral"
> > <Claves.DoAmaral@iggroup.com
> > >:
> > > -----Original Message-----
> > > From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> > >>
> > >>STOP FIGHTING MAVEN
> > >
> > > :)
> > >
> > > I will take the risky way, like Prometheus, and pay the consequences
> > > of my
> > hubris. I hope that Maven will have mercy on me.
> > >
> > >
> > >
> > > 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: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: How to compile twice

Posted by David McCabe <da...@sunlightd.com>.
In that case, how does one handle a single module build that produces
multiple artefacts? Is this 'not the Maven way'? What about multi-platform
builds? What about multiple output types (header files, DLLs, import
libraries and JNI JARs)?

I'm getting very confused by this, because the 'Maven way' seems to indicate
that I should have the following:

imaging-core-win32-x86-dll
imaging-core-win32-x86-lib
imaging-core-win32-x64-dll
imaging-core-win32-x64-lib
imaging-core-osx-x86-so
imaging-core-osx-x64-so
imaging-core-linux-glibc22-x86-so
imaging-core-jar
imaging-core-includes
...

as separate *modules* and then build each of these separately, rather than
simply building several things with different classifiers. That is a
nightmare. Maven must surely be suitable for more than collections of JARs.
What have I missed?
-- 
David

> -----Original Message-----
> From: anders.g.hammar@gmail.com [mailto:anders.g.hammar@gmail.com]
> On Behalf Of Anders Hammar
> Sent: Wednesday, 25 May 2011 3:49 PM
> To: Maven Users List
> Subject: RE: How to compile twice
> 
> It will not. I can tell you that for sure. The person that ends du
maintaining
> your build setup will curse your name forever!
> 
> /Anders (mobile)
> Den 25 maj 2011 16.44 skrev "Claves Do Amaral"
> <Claves.DoAmaral@iggroup.com
> >:
> > -----Original Message-----
> > From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> >>
> >>STOP FIGHTING MAVEN
> >
> > :)
> >
> > I will take the risky way, like Prometheus, and pay the consequences
> > of my
> hubris. I hope that Maven will have mercy on me.
> >
> >
> >
> > 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: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: How to compile twice

Posted by "Thiessen, Todd (Todd)" <tt...@avaya.com>.
How do you think the code review for this change will go? Left or right side? ;-)

http://www.gridshore.nl/wp-content/uploads/code-quality-measurement.jpg


> -----Original Message-----
> From: Claves Do Amaral [mailto:Claves.DoAmaral@iggroup.com]
> Sent: Wednesday, May 25, 2011 10:53 AM
> To: Maven Users List
> Subject: RE: How to compile twice
> 
> -----Original Message-----
> From: anders.g.hammar@gmail.com [mailto:anders.g.hammar@gmail.com] On
> Behalf Of Anders Hammar
> >It will not. I can tell you that for sure. The person that ends du
> maintaining your build setup will curse your name forever!
> 
> I will comment it very well...
> 
> What about using the Ant plugin?
> 
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: How to compile twice

Posted by Claves Do Amaral <Cl...@iggroup.com>.
-----Original Message-----
From: anders.g.hammar@gmail.com [mailto:anders.g.hammar@gmail.com] On Behalf Of Anders Hammar
>It will not. I can tell you that for sure. The person that ends du maintaining your build setup will curse your name forever!

I will comment it very well...

What about using the Ant plugin?

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: How to compile twice

Posted by Anders Hammar <an...@hammar.net>.
It will not. I can tell you that for sure. The person that ends du
maintaining your build setup will curse your name forever!

/Anders (mobile)
Den 25 maj 2011 16.44 skrev "Claves Do Amaral" <Claves.DoAmaral@iggroup.com
>:
> -----Original Message-----
> From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
>>
>>STOP FIGHTING MAVEN
>
> :)
>
> I will take the risky way, like Prometheus, and pay the consequences of my
hubris. I hope that Maven will have mercy on me.
>
>
>
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

RE: How to compile twice

Posted by Claves Do Amaral <Cl...@iggroup.com>.
-----Original Message-----
From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
>
>STOP FIGHTING MAVEN

:)

I will take the risky way, like Prometheus, and pay the consequences of my hubris. I hope that Maven will have mercy on me.



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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to compile twice

Posted by Stephen Connolly <st...@gmail.com>.
STOP FIGHTING MAVEN

Multi-module is your only man.... anything else is torture

On 25 May 2011 15:26, Claves Do Amaral <Cl...@iggroup.com> wrote:
> -----Original Message-----
> From: Jörg Schaible [mailto:joerg.schaible@scalaris.com]
>
>>It seems that the plugin will add the target directories automatically to the list of sources directory for the compiler. You need now two separate
>
> I see that the sources are added to the compileSourceRoots by the maven-idl-plugin:
>
> getProject().addCompileSourceRoot( getOutputDirectory() )
>
> At the time the compiler plugin is invoked I have the following setup:
>
> [DEBUG]   (f) compileSourceRoots = [C:\dev\Projects\non-versioned\test-attach-artifact\src\main\java, C:\dev\Projects\non-versioned\test-attach-artifact\target\generated-sources-jacorb\idl, C:\dev\Projects\non-versioned\test-attach-artifact\target\generated-sources-sunorb\idl]
>
> then, the
>
> <excludes>
>        <exclude>${project.build.directory}/generated-sources-sunorb/idl/**/*.java</exclude>
> </excludes>
>
> Does not have any effect since the excludes start from the source root, i.e. it's a filter that is applied to the subtree
>
> ...\target\generated-sources-jacorb\idl\uk\co\....
>
> but starting at uk.co.... i.e. it ignores the path up to .. \idl itself. Excludes does not help in this case since my generated sources are identical (package and classes names - of course, classes implementation are different).
>
> I need to modify the IDL plugin to add a flag to disable adding the generated source path to the compileSourceRoots.
>
> Then, I think it will be ok.
>
> Thanks everybody for the help.
>
> 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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: How to compile twice

Posted by Claves Do Amaral <Cl...@iggroup.com>.
-----Original Message-----
From: Jörg Schaible [mailto:joerg.schaible@scalaris.com]

>It seems that the plugin will add the target directories automatically to the list of sources directory for the compiler. You need now two separate

I see that the sources are added to the compileSourceRoots by the maven-idl-plugin:

getProject().addCompileSourceRoot( getOutputDirectory() )

At the time the compiler plugin is invoked I have the following setup:

[DEBUG]   (f) compileSourceRoots = [C:\dev\Projects\non-versioned\test-attach-artifact\src\main\java, C:\dev\Projects\non-versioned\test-attach-artifact\target\generated-sources-jacorb\idl, C:\dev\Projects\non-versioned\test-attach-artifact\target\generated-sources-sunorb\idl]

then, the

<excludes>
        <exclude>${project.build.directory}/generated-sources-sunorb/idl/**/*.java</exclude>
</excludes>

Does not have any effect since the excludes start from the source root, i.e. it's a filter that is applied to the subtree

...\target\generated-sources-jacorb\idl\uk\co\....

but starting at uk.co.... i.e. it ignores the path up to .. \idl itself. Excludes does not help in this case since my generated sources are identical (package and classes names - of course, classes implementation are different).

I need to modify the IDL plugin to add a flag to disable adding the generated source path to the compileSourceRoots.

Then, I think it will be ok.

Thanks everybody for the help.

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.

RE: How to compile twice

Posted by Jörg Schaible <jo...@scalaris.com>.
Hi Claves,

Claves Do Amaral wrote:

> -----Original Message-----
> From: Laird Nelson [mailto:ljnelson@gmail.com]
> 
>>How are you generating the sources?  This output indicates that the *
> 
> Here is the configuration:
> 
> <plugin>
>         <groupId>uk.co.igindex.maven</groupId>
>         <artifactId>maven-idl-plugin</artifactId>
>         <executions>
>                 <execution>
>                         <id>generate-jacorb</id>
>                         <goals>
>                                 <goal>generate</goal>
>                         </goals>
>                         <configuration>
>                                 <compiler>jacorb</compiler>
>                                 
<outputDirectory>${project.build.directory}/generated-sources-
jacorb/idl</outputDirectory>
>                                 
<timestampDirectory>${project.build.directory}/jacorb-
timestamp</timestampDirectory>
>                         </configuration>
>                 </execution>
>                 <execution>
>                         <id>generate-sunorb</id>
>                         <goals>
>                                 <goal>generate</goal>
>                         </goals>
>                         <configuration>
>                                 <compiler>idlj</compiler>
>                                 
<outputDirectory>${project.build.directory}/generated-sources-
sunorb/idl</outputDirectory>
>                                 
<timestampDirectory>${project.build.directory}/sunorb-
timestamp</timestampDirectory>
>                         </configuration>
>                 </execution>
>         </executions>
> </plugin>
> 
> The two executions of the IDL plugin generate the output folders with the
> generated sources for the two projects. You will notice that this is a
> custom IDL plugin.

It seems that the plugin will add the target directories automatically to 
the list of sources directory for the compiler. You need now two separate 
executions for the compiler plugin. In the default execution you will have 
to exclude the package used by the generated source of the IDL compiler, 
while the two other executions will compile the IDL-generated stuff (and 
exclude the default packages). However, you have to be aware of 
http://jira.codehaus.org/browse/MCOMPILER-37 to find a proper configuration 
;-)

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to compile twice

Posted by Anders Hammar <an...@hammar.net>.
Please, don't fight Maven! All the issues your running into are because of
this. And you will see other problems later on that you don't forsee right
now.
I strongly suggest that you follow Stephen's advice and move to a
multi-module build. If you don't want many artifacts for your clients, you
can solve that by creating an uber jar in each module. Regardless, the
solution is not classifiers or profiles. It very rarely is.

/Anders

On Tue, May 24, 2011 at 18:35, Claves Do Amaral <Claves.DoAmaral@iggroup.com
> wrote:

> -----Original Message-----
> From: Laird Nelson [mailto:ljnelson@gmail.com]
> > Wow, that's truly baffling.  I have a successful multi-artifact build
> running with inclusions and exclusions like this.  Are you using Maven 3+?
>
> Yes, Maven 3.0.2
>
> > The output looks like it.
>
> I will keep trying. I may have missed something
>
> > Keep us updated; this is interesting.
>
> Sure
>
> Thank you again
> 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.
>

RE: How to compile twice

Posted by Claves Do Amaral <Cl...@iggroup.com>.
-----Original Message-----
From: Laird Nelson [mailto:ljnelson@gmail.com]
> Wow, that's truly baffling.  I have a successful multi-artifact build running with inclusions and exclusions like this.  Are you using Maven 3+?

Yes, Maven 3.0.2

> The output looks like it.

I will keep trying. I may have missed something

> Keep us updated; this is interesting.

Sure

Thank you again
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.

Re: How to compile twice

Posted by Laird Nelson <lj...@gmail.com>.
On Tue, May 24, 2011 at 12:16 PM, Claves Do Amaral <
Claves.DoAmaral@iggroup.com> wrote:

> Thanks Laird, but I have already tried this:
>

Wow, that's truly baffling.  I have a successful multi-artifact build
running with inclusions and exclusions like this.  Are you using Maven 3+?
 The output looks like it.

Keep us updated; this is interesting.

Best,
Laird

RE: How to compile twice

Posted by Claves Do Amaral <Cl...@iggroup.com>.
-----Original Message-----
From: Laird Nelson [mailto:ljnelson@gmail.com]
> You can of course just chalk this up to magic and exclude them, regardless of whatever mystical internals put them there in the first place:

Thanks Laird, but I have already tried this:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
                <execution>
                        <id>default-compile</id>
                        <configuration>
                                <excludes>
                                        <exclude>${project.build.directory}/generated-sources-jacorb/**</exclude>
                                        <exclude>${project.build.directory}/generated-sources-sunorb/**</exclude>
                                </excludes>
                        </configuration>
                </execution>
....

With no success. I have the duplicate class error, again. Now, I am investigating to understand why and how the sources folders are "recorded" into the compiler plugin.

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.

Re: How to compile twice

Posted by Laird Nelson <lj...@gmail.com>.
On Tue, May 24, 2011 at 11:55 AM, Claves Do Amaral <
Claves.DoAmaral@iggroup.com> wrote:
>
> The two executions of the IDL plugin generate the output folders with the
> generated sources for the two projects. You will notice that this is a
> custom IDL plugin.
>

OK.  Nothing suspicious there.  I'm trying to figure out how the
maven-compiler-plugin's default-compile execution knows about the two
target/generated* directories.  Perhaps someone else knows.  Or maybe no one
knows.  Certainly the maven-compiler-plugin documentation is of no help
here.

You can of course just chalk this up to magic and exclude them, regardless
of whatever mystical internals put them there in the first place:

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <executions>
    <execution>
      <id>default-compile</id>
    </execution>
    <configuration>
      <excludes>

<exclude>${project.build.outputDirectory}/generated-sources-jacorb/**</exclude>

<exclude>${project.build.outputDirectory}/generated-sources-sunorb/**</exclude>
      </excludes>
      <!-- ...add your existing executions here... -->
    </configuration>
  </executions>
</plugin>


(Untested pom.xml code.)

Best,
Laird

RE: How to compile twice

Posted by Claves Do Amaral <Cl...@iggroup.com>.
-----Original Message-----
From: Laird Nelson [mailto:ljnelson@gmail.com]

>How are you generating the sources?  This output indicates that the *

Here is the configuration:

<plugin>
        <groupId>uk.co.igindex.maven</groupId>
        <artifactId>maven-idl-plugin</artifactId>
        <executions>
                <execution>
                        <id>generate-jacorb</id>
                        <goals>
                                <goal>generate</goal>
                        </goals>
                        <configuration>
                                <compiler>jacorb</compiler>
                                <outputDirectory>${project.build.directory}/generated-sources-jacorb/idl</outputDirectory>
                                <timestampDirectory>${project.build.directory}/jacorb-timestamp</timestampDirectory>
                        </configuration>
                </execution>
                <execution>
                        <id>generate-sunorb</id>
                        <goals>
                                <goal>generate</goal>
                        </goals>
                        <configuration>
                                <compiler>idlj</compiler>
                                <outputDirectory>${project.build.directory}/generated-sources-sunorb/idl</outputDirectory>
                                <timestampDirectory>${project.build.directory}/sunorb-timestamp</timestampDirectory>
                        </configuration>
                </execution>
        </executions>
</plugin>

The two executions of the IDL plugin generate the output folders with the generated sources for the two projects. You will notice that this is a custom IDL plugin.

>Is it possible that you're inheriting from another pom somewhere that has added these source directories to the default-compile execution?

No, this is not the case.

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.

Re: How to compile twice

Posted by Laird Nelson <lj...@gmail.com>.
On Tue, May 24, 2011 at 10:35 AM, Claves Do Amaral <
Claves.DoAmaral@iggroup.com> wrote:

> 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
>

How are you generating the sources?  This output indicates that the *
default-compile* execution is what is picking up the
generated-sources-jacorb source code.  Since I don't see anything in your
configuration that has added this source directory to the default-compile
execution I am not sure what you've got going on.

Is it possible that you're inheriting from another pom somewhere that has
added these source directories to the default-compile execution?

Best,
Laird

RE: How to compile twice

Posted by Martin Gainty <mg...@hotmail.com>.
use 2 asterisks for wildcard specifier
this will exclude everything from uhg and ingenix folders
     <id>default-compile</id>
      <configuration>
        <excludes>
          <exclude>**/uhg/*</exclude>
          <exclude>**/ingenix/*</exclude>
        </excludes>
      </configuration>

Cheers,
>  
> 
> > -----Original Message-----
> > From: Claves Do Amaral [mailto:Claves.DoAmaral@iggroup.com] 
> > Sent: Tuesday, May 24, 2011 10:59 AM
> > To: Maven Users List
> > Subject: RE: How to compile twice
> > 
> > -----Original Message-----
> > From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> > > One pom -> one artefact
> > >
> > > to create two artifacts, use a multi-module project.
> > 
> > Thanks for your answer.
> > I understand, but let me explain what I am trying to do, ultimately.
> > 
> > I already have a project that builds two different flavours 
> > of an artefact using profiles and classifiers.Invoking
> > 
> > mvn clean deploy -P jacorb
> > 
> > builds an artefact like myArtefact-1.0-SNAPSHOT-jacorb.jar Invoking
> > 
> > mvn clean deploy -P sunorb
> > 
> > builds an artefact like myArtefact-1.0-SNAPSHOT-sunorb.jar
> > 
> > The problem comes trying to a release:
> > 
> > mvn release:prepare release:perform
> > 
> > This generates and releases only one jar, the default one 
> > (jacorb), and I would like to attach a second jar (sunorb) to 
> > the release.
> > In order to do this, If I am not wrong, I need to have both 
> > artefact in my target folder and use the Build Helper Maven 
> > Plugin to attach the additional artefact.
> > 
> > But in order to have both artefact, I need to compile/package 
> > twice in the same build.
> > If I am wrong, please direct me to a resource where I can 
> > learn the correct procedure for doing this.
> > 
> > Cheers,
> > 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: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> > 
> 
> This e-mail, including attachments, may include confidential and/or
> proprietary information, and may be used only by the person or entity
> to which it is addressed. If the reader of this e-mail is not the intended
> recipient or his or her authorized agent, the reader is hereby notified
> that any dissemination, distribution or copying of this e-mail is
> prohibited. If you have received this e-mail in error, please notify the
> sender by replying to this message and delete this e-mail immediately.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
 		 	   		  

RE: How to compile twice

Posted by "Yanko, Curtis" <cu...@uhc.com>.
Another item on my list of why the Release Plugin is evil.

________________________________

Curt Yanko | Continuous Integration Services | UnitedHealth Group IT 
Making IT Happen, one build at a time, 600 times a day
 

> -----Original Message-----
> From: Claves Do Amaral [mailto:Claves.DoAmaral@iggroup.com] 
> Sent: Tuesday, May 24, 2011 10:59 AM
> To: Maven Users List
> Subject: RE: How to compile twice
> 
> -----Original Message-----
> From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> > One pom -> one artefact
> >
> > to create two artifacts, use a multi-module project.
> 
> Thanks for your answer.
> I understand, but let me explain what I am trying to do, ultimately.
> 
> I already have a project that builds two different flavours 
> of an artefact using profiles and classifiers.Invoking
> 
> mvn clean deploy -P jacorb
> 
> builds an artefact like myArtefact-1.0-SNAPSHOT-jacorb.jar Invoking
> 
> mvn clean deploy -P sunorb
> 
> builds an artefact like myArtefact-1.0-SNAPSHOT-sunorb.jar
> 
> The problem comes trying to a release:
> 
> mvn release:prepare release:perform
> 
> This generates and releases only one jar, the default one 
> (jacorb), and I would like to attach a second jar (sunorb) to 
> the release.
> In order to do this, If I am not wrong, I need to have both 
> artefact in my target folder and use the Build Helper Maven 
> Plugin to attach the additional artefact.
> 
> But in order to have both artefact, I need to compile/package 
> twice in the same build.
> If I am wrong, please direct me to a resource where I can 
> learn the correct procedure for doing this.
> 
> Cheers,
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: How to compile twice

Posted by Claves Do Amaral <Cl...@iggroup.com>.
-----Original Message-----
From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
>Classifiers is _exactly_ the ***wrong*** way to try and solve this
>
>Profiles is _exactly_ the ***wrong*** way to try and solve this.
>
>If you don't like the Maven way, don't use Maven

I like Maven, I love it!!!

But we decided to move to profiles/classifiers since this was a sensible thing to do, according to the book "Maven:The definitive guide", O'Reilly. You can find an e-copy also on the Sonatype web site.

The point is that we had multi-module projects earlier and we were not very happy with those since they were creating different artifacts for each ORB. We wanted to have only one artefact with many classifiers. To tidy up our repository and also to allow other teams to use our Corba connectors easily:

<dependency>
        <artifactId>corba-client</artifactId>
        <classifier>jacorb</classifier>
</dependency>

Anyway, I will think about it.

Thank you very much for your answers.

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to compile twice

Posted by Stephen Connolly <st...@gmail.com>.
Multi-module build

you will have a root project which aggregates the whole thing

you will have a common module for all the code that is common and is
depended on by the generated code (this is optional if there is no
such code)

you will have a module for the first set of generated code

you will have a module for the second set of generated code

Classifiers is _exactly_ the ***wrong*** way to try and solve this

Profiles is _exactly_ the ***wrong*** way to try and solve this.

If you don't like the Maven way, don't use Maven

On 24 May 2011 15:58, Claves Do Amaral <Cl...@iggroup.com> wrote:
> -----Original Message-----
> From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
>> One pom -> one artefact
>>
>> to create two artifacts, use a multi-module project.
>
> Thanks for your answer.
> I understand, but let me explain what I am trying to do, ultimately.
>
> I already have a project that builds two different flavours of an artefact using profiles and classifiers.Invoking
>
> mvn clean deploy -P jacorb
>
> builds an artefact like myArtefact-1.0-SNAPSHOT-jacorb.jar Invoking
>
> mvn clean deploy -P sunorb
>
> builds an artefact like myArtefact-1.0-SNAPSHOT-sunorb.jar
>
> The problem comes trying to a release:
>
> mvn release:prepare release:perform
>
> This generates and releases only one jar, the default one (jacorb), and I would like to attach a second jar (sunorb) to the release.
> In order to do this, If I am not wrong, I need to have both artefact in my target folder and use the Build Helper Maven Plugin to attach the additional artefact.
>
> But in order to have both artefact, I need to compile/package twice in the same build.
> If I am wrong, please direct me to a resource where I can learn the correct procedure for doing this.
>
> Cheers,
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: How to compile twice

Posted by Claves Do Amaral <Cl...@iggroup.com>.
-----Original Message-----
From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> One pom -> one artefact
>
> to create two artifacts, use a multi-module project.

Thanks for your answer.
I understand, but let me explain what I am trying to do, ultimately.

I already have a project that builds two different flavours of an artefact using profiles and classifiers.Invoking

mvn clean deploy -P jacorb

builds an artefact like myArtefact-1.0-SNAPSHOT-jacorb.jar Invoking

mvn clean deploy -P sunorb

builds an artefact like myArtefact-1.0-SNAPSHOT-sunorb.jar

The problem comes trying to a release:

mvn release:prepare release:perform

This generates and releases only one jar, the default one (jacorb), and I would like to attach a second jar (sunorb) to the release.
In order to do this, If I am not wrong, I need to have both artefact in my target folder and use the Build Helper Maven Plugin to attach the additional artefact.

But in order to have both artefact, I need to compile/package twice in the same build.
If I am wrong, please direct me to a resource where I can learn the correct procedure for doing this.

Cheers,
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How to compile twice

Posted by Stephen Connolly <st...@gmail.com>.
On 24 May 2011 15:35, Claves Do Amaral <Cl...@iggroup.com> 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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: How to compile twice

Posted by "Yanko, Curtis" <cu...@uhc.com>.
We'd handle this in our CI system by running two jobs in parallel
coupled to different tooling.

________________________________

Curt Yanko | Continuous Integration Services | UnitedHealth Group IT 
Making IT Happen, one build at a time, 600 times a day
 

> -----Original Message-----
> From: Claves Do Amaral [mailto:Claves.DoAmaral@iggroup.com] 
> Sent: Tuesday, May 24, 2011 10:35 AM
> To: Maven Users List
> Subject: How to compile twice
> 
> 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.
> 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</ou
> tputDirectory>
>                                                               
>   <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</ou
> tputDirectory>
>                                                               
>   <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-ja
> corb\idl\uk\co\igindex\corba\service\V3_0\NoDataHelper.java:[1
> 1,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.
> 

This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org