I have a used the maven assembly plugin to create multiple jar from one jar now the problem is that I have to publish these jar to the local repo, just like other maven jars publish by them self when they are built maven clean install how will I be able to do this
here is my pom file
<project>
<parent>
<groupId>parent.common.bundles</groupId>
<version>1.0</version>
<artifactId>child-bundle</artifactId>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>common.dataobject</groupId>
<artifactId>common-dataobject</artifactId>
<packaging>jar</packaging>
<name>common-dataobject</name>
<version>1.0</version>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jibx</groupId>
<artifactId>maven-jibx-plugin</artifactId>
<version>1.2.1</version>
<configurati开发者_JAVA百科on>
<directory>src/main/resources/jibx_mapping</directory>
<includes>
<includes>binding.xml</includes>
</includes>
<verbose>false</verbose>
</configuration>
<executions>
<execution>
<goals>
<goal>bind</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-business-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<finalName>flight-dto</finalName>
<descriptors>
<descriptor>src/main/assembly/car-assembly.xml</descriptor>
</descriptors>
<attach>true</attach>
</configuration>
</execution>
<execution>
<id>make-gui-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<finalName>app_gui</finalName>
<descriptors>
<descriptor>src/main/assembly/bike-assembly.xml</descriptor>
</descriptors>
<attach>true</attach>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Here is my assembly file
<assembly>
<id>app_business</id>
<formats>
<format>jar</format>
</formats>
<baseDirectory>target</baseDirectory>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
<outputDirectory></outputDirectory>
<includes>
<include>com/dataobjects/**</include>
</includes>
</fileSet>
</fileSets>
</assembly>
The Build Helper Maven Plugin has a build-helper:attach-artifact
allowing to attach additional artifacts to be installed and deployed. It's typically used like this (from the Usage page):
<project>
...
<build>
<plugins>
<plugin>
<!-- add configuration for antrun or another plugin here -->
</plugin>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>some file</file>
<type>extension of your file </type>
<classifier>optional</classifier>
</artifact>
...
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Thanks a lot Pascal, This thing really works. Here is a the configuration that i have added too make it work..
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>abc</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>src/main/assembly/flight-assembly.xml</file>
<type>xml</type>
<classifier>flight</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
精彩评论