Hi,

I'm trying to port the Cargo build to m2 and I'm now tackling the
distribution part. Right now, I have the following directory structure for
m1:

cargo/
  |_ core/
    |_ container/
    |_ generic/
    |_ util/
    |_ module/
  |_ distribution/
  |_ extensions/
    |_ ant/
  |_ [...]

The core/* modules produce private jar artifacts (they're not made public)
and we want to aggregate them into a single jar that will be published
(public artifact).

Right now, we achieve this by defining a distribution project which creates
the aggregated jar.

We'd like to have the same with m2. I have started using the assembly plugin
in the cargo/core/ project's POM but I have not been successful so far.
Here's what I have added to cargo/core/pom.xml:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <configuration>
              <descriptor>src/assemble/jar.xml</descriptor>
              <finalName>cargo-core-0.6-SNAPSHOT</finalName>
            </configuration>
            <goals>
              <goal>assembly</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

The jar.xml is:

<assembly>
  <id>jar</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <fileSets>
    <fileSet>
      <directory>target</directory>
      <outputDirectory>/</outputDirectory>
      <includes>
        <include>cargo-core-*.jar</include>
      </includes>
    </fileSet>
  </fileSets>
</assembly>

Note: I'm sure the format is wrong here. The goal is to aggregate the jars
produced by the 4 submodules (container/, module/, util/ and generic/).

The problem is that it apparently does not work the way I imagined:

- Running "m2 install" in cargo/core generates an empty jar. That's because
the jar.xml format is probably wrong but also because the cargo/core project
is executed before the submodules so there's an issue in the execution order
which leads me to believe I'm not using it in the right way.

- As the modules inherit from cargo/core/pom.xml, they are also looking for
a src/assemble/jar.xml file. This is not the behavior I'd like as it's only
the core project that should perform the aggregation.

- Last, I'd like that the aggregated jar is considered a proper artifact so
that it can also be installed/deployed as any other artifact. The idea is
also to have the cargo/extensions/ant project depend on it in its
dependencies list.

Any idea how I could achieve this use case? What am I doing wrong?

Thanks a lot
-Vincent


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to