Am Dienstag 21 Juli 2009 13:44:50 schrieb Thomas Scheffler:
> Hi,
>
> I am migrating a larger project from ant to maven 2. The resulting JAR file
> has to be in a specific structure. At the moment I am almost done. One
> thing is still missing:
>
> I have to provide a jar file (java applet) inside the jar file that is
> compiled against jdk 1.4 while the project itself is 1.5. The applet
> contains a subset of the classes of the whole project.
>
> Neither do I know how a class can be compiled twice (with different java
> target version) nor how to embed the applet jar into the project jar.
>
> Any ideas?
My current solution - for the records - is to run ant within the "compile"
phase.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<configuration>
<tasks>
<path id="compile.classpath" refid="maven.compile.classpath" />
<property name="target.applet.classes"
location="${project.build.directory}/applet-classes" />
<path id="sources.path">
<dirset dir="${basedir}" includes="src/main/java" />
</path>
<echo message="compile classpath: ${compile.classpath}" />
<echo message="target directory: ${target.applet.classes}" />
<mkdir dir="${target.applet.classes}" />
<javac destdir="${target.applet.classes}"
includes="my.applet.classes/**"
excludes="i.do.not.want.these/*here*"
classpathref="compile.classpath"
debug="true" optimize="true" target="1.4" source="1.4"
encoding="ISO-8859-15" fork="yes" deprecation="off">
<src>
<path refid="sources.path" />
</src>
</javac>
<copy todir="${target.applet.classes}">
<fileset dir="${basedir}/src/main/applet-resources">
<include name="**/*" />
</fileset>
</copy>
<jar jarfile="${project.build.outputDirectory}/applet-unsigned.jar">
<fileset dir="${target.applet.classes}" />
</jar>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
regards
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]