You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Thomas Harris <th...@axispoint.com> on 2010/03/01 23:56:29 UTC

Including sibling module attachment inside another module artifact

Maven Users:

I have been searching for examples of how to make this work, but I must be missing something.

We have a multimodule project, along these lines:

proj-parent
|-  modules
    |- module1
         |- target
             |- module1-1.0.0-classifiername.jar
    |- module2
         |- WebRoot
              |- XXX

module1's output is two jar files, one the standard output, and the other the extra one defined with includes/excludes using the maven-jar-plugin and a classifier.

What I want to do is include this attachment inside the module2 war artifact, under that XXX folder. The WebRoot folder is defined to be the staging area for the war artifact.

I have tried to use an assembly to do this, but it has no effect. The modules project defines this in its build plugins:

      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>src/assemble/classifiername.xml</descriptor>
          </descriptors>
        </configuration>
      </plugin>

I put the classifiername.xml under the modules project in the src/assemble folder, and it contains:

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
  <moduleSets>
    <moduleSet>
      <includes>
        <include>*:module1</include>
      </includes>
      <binaries>
        <attachmentClassifier>classifiername</attachmentClassifier>
        <outputDirectory>module2/WebRoot/lib</outputDirectory>
        <outputFileNameMapping>foo.jar</outputFileNameMapping>
      </binaries>
    </moduleSet>
  </moduleSets>
</assembly>

But, when I run mvn clean install, the war file does not contain the file, and the build output never mentions it even tried to follow the instructions, no errors either. How do I get this to work?

This artifact is a special jar that gets deployed to clients via the web using Java Web Start, and this is a port of an existing project, so I cannot change the internal folder layout of the war.

(Names of the artifacts and projects have been changed to protect the innocent.)

Tom Harris

RE: Including sibling module attachment inside another module artifact

Posted by Thomas Harris <th...@axispoint.com>.
Correction:
The assembly file should have actually said:
<outputDirectory>module2/WebRoot/XXX</outputDirectory>

Typing error in the email... Still need help getting this to work. Thanks.

Tom Harris

-----Original Message-----
From: Thomas Harris 
Sent: Monday, March 01, 2010 5:56 PM
To: users@maven.apache.org
Subject: Including sibling module attachment inside another module artifact

Maven Users:

I have been searching for examples of how to make this work, but I must be missing something.

We have a multimodule project, along these lines:

proj-parent
|-  modules
    |- module1
         |- target
             |- module1-1.0.0-classifiername.jar
    |- module2
         |- WebRoot
              |- XXX

module1's output is two jar files, one the standard output, and the other the extra one defined with includes/excludes using the maven-jar-plugin and a classifier.

What I want to do is include this attachment inside the module2 war artifact, under that XXX folder. The WebRoot folder is defined to be the staging area for the war artifact.

I have tried to use an assembly to do this, but it has no effect. The modules project defines this in its build plugins:

      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>src/assemble/classifiername.xml</descriptor>
          </descriptors>
        </configuration>
      </plugin>

I put the classifiername.xml under the modules project in the src/assemble folder, and it contains:

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
  <moduleSets>
    <moduleSet>
      <includes>
        <include>*:module1</include>
      </includes>
      <binaries>
        <attachmentClassifier>classifiername</attachmentClassifier>
        <outputDirectory>module2/WebRoot/lib</outputDirectory>
        <outputFileNameMapping>foo.jar</outputFileNameMapping>
      </binaries>
    </moduleSet>
  </moduleSets>
</assembly>

But, when I run mvn clean install, the war file does not contain the file, and the build output never mentions it even tried to follow the instructions, no errors either. How do I get this to work?

This artifact is a special jar that gets deployed to clients via the web using Java Web Start, and this is a port of an existing project, so I cannot change the internal folder layout of the war.

(Names of the artifacts and projects have been changed to protect the innocent.)

Tom Harris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org