You have to specific the plugin dependency in the pom.xml if u want to use the installer task of AntInstaller in Maven.
Unfortunately, the ant-installer.jar and ant-installer-ext.jar cannot be found in default Maven repository. So u have to manually upload these 2 jars to the repository manager. If you have no idea about Maven repository manager, take a look at the following 2 articles.
Let’s make AntInstaller work in Maven =).
Configure the maven-antrun-plugin in the pom.xml as follow.
<!-- Build Configuration --> <build> <plugins> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.3</version> <dependencies> <dependency> <groupId>ant-installer</groupId> <artifactId>ant-installer</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>ant-installer-ext</groupId> <artifactId>ant-installer-ext</artifactId> <version>1.0</version> </dependency> </dependencies> <executions> <execution> <id>initialize</id> <phase>initialize</phase> <configuration> <tasks> <!-- add the ant tasks from ant installer --> <taskdef name="installer" classname="org.tp23.antinstaller.taskdefs.Installer" /> <!-- configure the isntaller task --> <installer file="../artifacts/selfextractpack.jar" compress="true" extractType="SelfExtractor" installConfig="../installer/antinstall-config.xml" buildFile="../installer/build.xml" antInstallLib="${installDir}/lib" antLib="${installDir}/antlib" validateConfig="true" failOnError="true" icons="bluecurve"> <fileset dir="${demo.dir}/artifacts"> <include name="installpack.zip"/> </fileset> <fileset dir="${demo.dir}/installclasspath"> <include name="resources/*"/> </fileset> </installer> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
Put the AntInstaller required files such as the antinstall-config.xml, build.xml and those libraries in the corresponding location in your Maven project specified in the above pom.xml.
Now if u run mvn initialize, the installer build process will be triggered.
Done =)
Filed under: Maven Tagged: AntInstaller, Archiva, Maven, maven-antrun-plugin
