I am trying to install maven-assembly-plugin's output (zip file) into local
repository but I am not successful so far.


Below is crippled contents of my parent pom file:


<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";>

      <modelVersion>4.0.0</modelVersion>

      <groupId>com.mycompany.myapp</groupId>

      <artifactId>MyApplication</artifactId>

      <packaging>pom</packaging>

      <version>3.2.1</version>

      <name>My Tool</name>



      <dependencyManagement>

            <dependencies>

                  <dependency>

                        <groupId>com.mycompany.myapp</groupId>

                        <artifactId>Api</artifactId>

                        <version>${project.version}</version>

                  </dependency>

                  <dependency>

                        <groupId>com.mycompany.myapp</groupId>

                        <artifactId>Common</artifactId>

                        <version>${project.version}</version>

                  </dependency>

            </dependencies>

      </dependencyManagement>



      <build>

            <plugins>

                  <plugin>

                        <groupId>org.apache.maven.plugins</groupId>

                        <artifactId>maven-assembly-plugin</artifactId>

                        <configuration>

                             <descriptors>

                                   <descriptor>

                                         ${basedir}/build/assembly/dep.xml

                                   </descriptor>

                             </descriptors>

                             <outputDirectory>

                                   ${project.build.directory}/release

                             </outputDirectory>

                        </configuration>

                  </plugin>

            </plugins>

      </build>



      <modules>

            <module>Api</module>

            <module>Common</module>

      </modules>



</project>



I am building this project with following command:

mvn clean install package assembly:assembly


So far, there is no problem. Maven builds sub-projects, installs their jars
and creates a zip archive in the release directory.

Now I need to install this zip archive (the output of assembly plugin) into
local repository as well. To accomplish this task, build-helper plugin
seemed appropriate. Below is the added plug-ins part of the parent pom.




<plugin>

      <groupId>org.codehaus.mojo</groupId>

      <artifactId>build-helper-maven-plugin</artifactId>

      <configuration>

            <artifacts>

                  <artifact>

                        <file>


${project.build.directory}/release/${project.artifactId}-${project.version}.zip

                        </file>

                        <type>zip</type>

                  </artifact>

            </artifacts>

      </configuration>

</plugin>



I have come up with following command, which seems somewhat wrong, but does
the job of installing the archive to the repository:

mvn clean install package assembly:assembly build-helper:attach-artifact
install

However, the problem with this command is, it tries to locate zip archive of
modules, which don't exist, thus fails the build:

[INFO] Installing
D:\projects\MyApplicationRoot\Api\target\release\Api-3.2.1.zip to
C:\Documents and
Settings\Administrator\.m2\repository\com\mycompany\myapp\myapplication\Api\3.2.1\Api-3.2.1.zip

[INFO]
------------------------------------------------------------------------

[ERROR] BUILD ERROR

[INFO]
------------------------------------------------------------------------

[INFO] Error installing artifact: File
D:\projects\MyApplicationRoot\Api\target\release\Api-3.2.1.zip does not
exist


I guess I might be:

   - Using wrong plugin?
   - Using wrong command?
   - Shooting the moon?

Any help is appreciated, thanks in advance.
 Bahri

Reply via email to