I want to build two versions of an application, the only difference is I want to swap in a different version of one particular .java
file. I already have a Maven build for building the source, plus an Ant build to then package up as a zip
with an embedded JRE.
So I can modify my Ant build to create another zip
file for this new build but what would be the best way to handle the rebuilding of the source with the single amended source file?
Updated With Progress
I have now subclassed the starting class with the main()
method, so no longer have to swap source files around instead we simply need to pass a difference value for the mainClass
in the manifest and we now only have one source tree to build.
So in my pom.xml
I have :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>com.companyname.StartClass</mainClass>
<packageName>com.companyname</packageName>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
So can I have multiple of these assembly plugins so I can build two assemblies just differing in the manifest?