JBoss has a custom maven-jboss-compiler-plugin that seems to do this.
I solved this myself by configuring the compiler plugin to run twice,
and excluding non Java1.3 classes for default (first) compile. But this
require to setup in the POM excludes patterns :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!--
By default, compile for full Java 1.3 compatibility
-->
<source>1.3</source>
<target>1.3</target>
<compilerArguments>
<bootclasspath>
${settings.localRepository}/com/sun/rt/1.3.1_18/rt-1.3.1_18.jar
</bootclasspath>
</compilerArguments>
</configuration>
<executions>
<execution>
<id>compile_java_1.5</id>
<phase>compile</phase>
<goals><goal>compile</goal></goals>
<configuration>
<source>1.5</source>
<target>1.5</target>
<compilerArguments>
<bootclasspath>
${settings.localRepository}/com/sun/rt/1.5.0_06/rt-1.5.0_06.jar
</bootclasspath>
</compilerArguments>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>rt</artifactId>
<version>1.3.1_18</version>
</dependency>
<dependency>
<groupId>com.sun</groupId>
<artifactId>rt</artifactId>
<version>1.5.0_06</version>
</dependency>
</dependencies>
</plugin>
Ruel Loehr a écrit :
No. The compiler plugin is not flexible enough to be changed and then reran.
I encountered the same problem. I needed to produce java1.4 and java1.5 code
and did not want to split the code into 2 separate projects.
I had to create my own compiler plugin and bind it to a random phase prior to
jarring which would be executed as part of a java1.5 profile. This was in
addition to the default compiler.
Very, very ugly solution, but it was the only one which I could find.
What we would need, for this to work well is:
1) The compiler plugin would need to be able to be bound to different phases
(e.g. a custom compiler phase)
2) The compiler plugin would need to be configurable (e.g. I can overwrite the
default src dir with one of my own choosing)
Ruel Loehr
JBoss QA
-----Original Message-----
From: Nicolas De Loof [mailto:[EMAIL PROTECTED]
Sent: Monday, August 21, 2006 10:31 AM
To: Maven Users List
Subject: [m2] howto run the maven compiler two times ?
Hello,
I've a requirement for a utility lib to include both Java1.3 and Java5
code. I don't want to split my lib into two jars, but to split the
source three into src/main/java and src/main/tiger. I'm searching for a
way to configure the compiler plugin for this.
I've set two compiler configuration (default config is for 1.3 and
<id>tiger</id> execution for java5)
I've tried to use the build-helper plugin, but I cannot make int run
between compiler default execution (java13) and compiler java5 execution.
I've also looked at compiler doc, but "|compileSourceRoots|" seems to be
readonly.
My requirement seems not to be so strange : take a look at Spring or any
other utility/framework that want to add support for Java5 witout
breaking existing code.
Is there any known solution for this ?
Nico.
This message contains information that may be privileged or confidential and is
the property of the Capgemini Group. It is intended only for the person to whom
it is addressed. If you are not the intended recipient, you are not authorized
to read, print, retain, copy, disseminate, distribute, or use this message or
any part thereof. If you receive this message in error, please notify the
sender immediately and delete all copies of this message.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This message contains information that may be privileged or confidential and is
the property of the Capgemini Group. It is intended only for the person to whom
it is addressed. If you are not the intended recipient, you are not authorized
to read, print, retain, copy, disseminate, distribute, or use this message or
any part thereof. If you receive this message in error, please notify the
sender immediately and delete all copies of this message.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]