Re: Producing 2 jars from same sources with different java version ?

2012-03-16 Thread jerem
Well I managed that with a 3-modules solution ... One containing the source
code, the 2 others copy the sources and compile them with different source
and target values.
I believe, even if possible, that it would be quite ugly (well, more) to
stuck that in a unique module ...

--
View this message in context: 
http://maven.40175.n5.nabble.com/Producing-2-jars-from-same-sources-with-different-java-version-tp5570446p5570975.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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



Re: Producing 2 jars from same sources with different java version ?

2012-03-16 Thread Tim Pizey
On 16 March 2012 09:49, jerem  wrote:
 Hi,

 I wonder if it would be possible with Maven to produce, from a same module
 sources, 2 different jars with classes compiled with different source and
 target values ?

 I'm up to using -d directory as compilerArgument of the
 maven-compiler-plugin, but it fails with :
  javac: invalid flag: -d directory

 If I run maven with -X option and test the javac command-line logged, it
 works though ...

 If that worked I would have 2 executions of compiler (producing
 target/classes-15 and target/classes-16), then would use 2 executions of
 maven-jar-plugin to produce both jars with different classifiers if
 possible.

 Thanks for help,
 Jeremie

I suggest you use profiles then you can specify different
compiler options in each profile and invoke with

mvn deploy -Pjava15
mvn deploy -Pjava16

cheers
Tim



-- 
Tim Pizey - http://pizey.net/~timp

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



Re: Producing 2 jars from same sources with different java version ?

2012-03-16 Thread Anders Hammar
That's not a good solution. IMO, a good Maven build should build
everything in one build execution so that it gets deployed to the
repo. A correctly repo manager should prevent redeploys. If you build
twice, the pom will be redeployed.

/Anders

On Fri, Mar 16, 2012 at 12:34, Tim Pizey tim.pi...@gmail.com wrote:
 On 16 March 2012 09:49, jerem  wrote:
 Hi,

 I wonder if it would be possible with Maven to produce, from a same module
 sources, 2 different jars with classes compiled with different source and
 target values ?

 I'm up to using -d directory as compilerArgument of the
 maven-compiler-plugin, but it fails with :
  javac: invalid flag: -d directory

 If I run maven with -X option and test the javac command-line logged, it
 works though ...

 If that worked I would have 2 executions of compiler (producing
 target/classes-15 and target/classes-16), then would use 2 executions of
 maven-jar-plugin to produce both jars with different classifiers if
 possible.

 Thanks for help,
 Jeremie

 I suggest you use profiles then you can specify different
 compiler options in each profile and invoke with

 mvn deploy -Pjava15
 mvn deploy -Pjava16

 cheers
 Tim



 --
 Tim Pizey - http://pizey.net/~timp

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


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



Re: Producing 2 jars from same sources with different java version?

2012-03-16 Thread Jörg Schaible
jerem wrote:

 Well I managed that with a 3-modules solution ... One containing the
 source code, the 2 others copy the sources and compile them with different
 source and target values.
 I believe, even if possible, that it would be quite ugly (well, more) to
 stuck that in a unique module ...

From your description I wonder why you need it. If the same source can be 
compiled without modification for Java 5 or Java 6, simply target Java 5.

Regards,
Jörg


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