Reputation: 69
Having read about every posting and question that I can find, I'm stumped on finding a better way than just using profiles of doing the following.
I need to take the same set of modules, and compile them for vastly different architectures (J2ME vs. J2SE), they need different dependencies for some libraries, and they need different source/target/debug settings at compilation time.
Using profiles and classifiers, I can do this by running with one profile, cleaning, and running a build with the other profile. The classifiers sort out the results. However, if you just change profiles and rebuild, it won't clean on it's own, it requires multiple running of maven against the super-pom, and it won't allow you to enable multiple profiles at the same time (and the resultant mess when you do is pretty ugly).
Could I do something using attached artifacts and forcing the compile and jar steps to run multiple times?
The javac options are really the kicker: (using profiles for the dependencies doesn't cause any issues)
for J2ME:
source=1.4
target=1.4
-g:source
for J2ME debugging
source=1.4
target=1.4
for J2SE
source=1.5
target=1.5
Upvotes: 3
Views: 718
Reputation: 18659
Could you explicitly invoke the compiler plugin Maven Compiler Plugin and then define multiple executions. Some thing like
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<executions>
<execution>
<id>compile1</id>
<phase>generate-resources</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable><!-- path-to-javac --></executable>
<compilerVersion>1.3</compilerVersion>
</configuration>
</execution>
<execution>
<id>compile1</id>
<phase>generate-resources</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable><!-- path-to-javac --></executable>
<compilerVersion>1.3</compilerVersion>
</configuration>
</execution>
</executions>
</plugin>
Upvotes: 2