Hi,

On 17/06/17 16:23, Christofer Dutz wrote:
I Karl Heinz,

I think that’s a really good idea … unfortunately I can’t seem to be able to 
run the retrolambda plugin on jars, so I might setup little projects, that use 
the dependency-plugin to unpack the jars and test-jars first and run the 
retrolambda on them and then package them back. Eventually this might also help 
running the testsuite a second time, but with Java7. Is there a way to have 
maven execute tests with a different java version (Run maven with Java 8 and 
execute the tests with Java 7)?  Right now I’m relying on the animalsniffer 
plugin  to verify my java8 and java7 jars, but the others would feel more 
comfortable if we really ran the tests with a different java version.

That's example for using toolchains...

Running Maven with Java 8 and running Tests with Java 7 ...which should be a separate module (otherwise the configuration would be a nightmare)...

If I correctly understand that scenario you have a jar build with Java 8 in a module call it "xyz-jdk8" also having tests for that ...

Now you need another module (defining toolchains using JDK 7) running your tests with surefire (I can remember there is an option to scan existing jars which contain tests found it: dependenciesToScan )...and run the tests and repackage after retolambda...But you have to be sure that the tests don't use JDK 8 specific parts cause they will run on JDK 7 ...

Should working I didn't even test it...

Kidn regards
Karl Heinz Marbaise



Chris

Am 16.06.17, 14:36 schrieb "Karl Heinz Marbaise" <khmarba...@gmx.de>:

     Hi,
I would make a separate module for java8 and run there the retrolambda-
     maven-plugin and another separate module for java7 and run there the
     retrolambda-
     maven-plugin as well...than you can make a separate jar file for each ...
No need for different executions of the compiler plugins etc. and
     separte output folders configurations etc.
This needs to use toolchains and then you can run with a single
     run...all of them...
Just coming into my mind... If i correctly understand you are developing in JDK 8 and than you would
     like to offer a package which supports JDK 7 ..
So making a module with JDK 8 code in it pluse unit tests... A separate module which uses the JDK 8 code as dependency and using the
     retrolambda plugin and maybe some supplemental tests on it...using JDK 7
     which can be handled with Toolchain...
Kind regards
     Karl Heinz Marbaise
On 16/06/17 14:25, Justin Georgeson wrote:
     > Instead of tweaking the version, I would configure an executions of the 
compiler plugins compile and testcompile goals to a separate output folders, like 
${build.directory}${file.separator}classes-java7 and 
${build.directory}${file.separator}test-classes-java7 and then an execution of the 
jar plugin to create/attach a jar with classifier set to 'java7'.
     >
     > 
https://maven.apache.org/plugins/maven-jar-plugin/examples/attached-jar.html
     >
     > That way you can have both versions build/deploy together in one 
pipeline with the same version.
     >
     > You can use properties in the version if you use Maven 3.5 with some 
other tricks, there was a recent thread on the list about it
     >
     > http://www.mail-archive.com/users@maven.apache.org/msg139475.html
     >
     >
     >> -----Original Message-----
     >> From: Christofer Dutz [mailto:christofer.d...@c-ware.de]
     >> Sent: Friday, June 16, 2017 3:54 AM
     >> To: Maven List <users@maven.apache.org>
     >> Subject: [EXTERNAL] Follow up: Building projects for multiple platforms
     >>
     >> External Sender: Use caution with links/attachments.
     >>
     >>
     >>
     >> Hi,
     >>
     >> A short follow up question regarding my last one.
     >> In the Edgent maven build, which I am working on, we need to produce 
java8,
     >> java7 and android versions of jars. This is done by running the 
retrolambda-
     >> maven-plugin on the classes when building the java7 version. To make the
     >> dependency resolution work correctly with all variants we decided to 
use the
     >> normal version number for the java8 output and add a suffix of “–java7” 
to the
     >> version in case of a java7 build (for SNAPSHOT versions the “-java7” is 
included
     >> between the version and the “SNAPSHOT”). In order to be able to switch 
the
     >> versions by selecting profiles, I used variables for the artifact 
versions.
     >> As I know variables for versions of parent poms is a really bad idea 
(Don’t even
     >> know if it works), I setup the project to have constant versions in the 
parent
     >> poms and only use these for configuring the reactor and the plugins – no
     >> dependencies are handled here. The build is working nicey, 
unfortunately the
     >> build is outputting hundreds of warnings like this:
     >>
     >> [WARNING] Some problems were encountered while building the effective 
model
     >> for 
org.apache.edgent.analytics:edgent-analytics-sensors:jar:1.2.0-SNAPSHOT
     >> [WARNING] 'version' contains an expression but should be a constant. @
     >> org.apache.edgent.analytics:edgent-analytics-sensors:${edgent.version},
     >> /Users/christoferdutz/Projects/Apache/Edgent/incubator-
     >> edgent/analytics/sensors/pom.xml, line 31, column 12
     >>
     >> Is there a “maven way” (TM) to achieve this sort of thing without the 
warnings?
     >>
     >> Chris
     >
     > ----------------------------------------------------------------------
     > This e-mail, including any attached files, may contain confidential and 
privileged information for the sole use of the intended recipient.  Any review, 
use, distribution, or disclosure by others is strictly prohibited.  If you are not 
the intended recipient (or authorized to receive information for the intended 
recipient), please contact the sender by reply e-mail and delete all copies of 
this message.
     >
     > ---------------------------------------------------------------------
     > 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

Reply via email to