You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jim Garrison <Ji...@troux.com> on 2008/11/04 21:28:08 UTC

Aggregate POM for thirdparty package - dependencies not downloaded

I'm trying to create an aggregate POM for a third-party object
consisting of several binary (jar) files, to be stored in my
Nexus repository.

Based on examples from the maven repository, I created simple POMs for
each jar and added them to nexus. Then I created a POM-packaged POM that
lists the individual simple POMs as dependencies.  When I got to the
Upload Artifact screen I found that I had to provide an artifact file
name, so I ended up using the aggregate pom name in both the artifact
file and pom file fields (was this correct?)

When I try to build my project POM, which contains a reference to the
aggregate POM, there are no error messages but the transitive
dependencies are NOT downloaded from Nexus.  Browsing the repository
shows all the required jars in the right places.

Obviously I've missed something.  Can some kind soul take pity on a
Maven/Nexus newbie and help out?

Here are the pertinent files:

Simple POM for one of the jar file components (jviews-sdmgui.pom):

<project  xmlns="http://maven.apache.org/POM/4.0.0">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.ilog.jviews</groupId>
        <artifactId>sdmgui</artifactId>
        <version>5.5</version>
        <description>JViews sdmgui library</description>
</project>

Aggregate POM (jviews.pom):

<project  xmlns="http://maven.apache.org/POM/4.0.0">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.ilog</groupId>
        <artifactId>jviews</artifactId>
        <version>5.5</version>
        <description>JViews</description>
        <packaging>pom</packaging>
        <dependencies>
                <dependency>
                        <groupId>com.ilog.jviews</groupId>
                        <artifactId>jviewsall</artifactId>
                        <version>5.5</version>
                </dependency>
                <dependency>
                        <groupId>com.ilog.jviews</groupId>
                        <artifactId>sdmgui</artifactId>
                        <version>5.5</version>
                </dependency>
                <dependency>
                        <groupId>com.ilog.jviews</groupId>
                        <artifactId>svgdom</artifactId>
                        <version>5.5</version>
                </dependency>
        </dependencies>
</project>

Dependency specification in the project POM:

        <dependency>
                <groupId>com.ilog</groupId>
                <artifactId>jviews</artifactId>
                <version>5.5</version>
                <type>pom</type>
        </dependency>

If I include the three individual dependencies here instead of just the
reference to the aggregate, the build works.

http://www.troux.com/email
 
 

 
 

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


Re: Aggregate POM for thirdparty package - dependencies not downloaded

Posted by Stephen Connolly <st...@gmail.com>.
Well it depends on the three libs....

I was just suggesting a more *maven* way of getting the pom's and the jars
into the repo.

if you add the dependencies to the other jars to the poms that you are
pushing, then depending on one will pull in its dependents

for example if jviewsall depends on both sdmgui and svgdom, all you need is
three poms like I had, e.g.

%basedir%/sdmgui/pom.xml

<project  xmlns="http://maven.apache.org/POM/4.0.0">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.ilog.jviews</groupId>
    <artifactId>sdmgui</artifactId>
    <version>5.5-SNAPSHOT</version>
    <description>JViews sdmgui library</description>
    <build>
      <plugins>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <forceCreation>true</forceCreation>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>run</goal>
              </goals>
              <configuration>
                <tasks>
                  <copy file="${basedir}/src/jar/${project.artifactId}"

tofile="${project.build.directory}/${project.build.finalName}"
                     overwrite="true"/>
                </tasks>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
</project>

%basedir%/svgdom/pom.xml

<project  xmlns="http://maven.apache.org/POM/4.0.0">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.ilog.jviews</groupId>
    <artifactId>svgdom</artifactId>
    <version>5.5-SNAPSHOT</version>
    <description>JViews svgdomlibrary</description>
    <build>
      <plugins>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <forceCreation>true</forceCreation>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>run</goal>
              </goals>
              <configuration>
                <tasks>
                  <copy file="${basedir}/src/jar/${project.artifactId}"

tofile="${project.build.directory}/${project.build.finalName}"
                     overwrite="true"/>
                </tasks>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
</project>


%basedir%/jviewsall/pom.xml

<project  xmlns="http://maven.apache.org/POM/4.0.0">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.ilog.jviews</groupId>
    <artifactId>jviewsall</artifactId>
    <version>5.5-SNAPSHOT</version>
    <dependencies>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>sdmgui</groupId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>svgdom</groupId>
        <version>${project.version}</version>
      </dependency>
    </dependencies>

    <description>JViews sdmgui library</description>
    <build>
      <plugins>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <forceCreation>true</forceCreation>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>run</goal>
              </goals>
              <configuration>
                <tasks>
                  <copy file="${basedir}/src/jar/${project.artifactId}"

tofile="${project.build.directory}/${project.build.finalName}"
                     overwrite="true"/>
                </tasks>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
</project>

The aggregator pom would just be to help release all of them (as you would a
normal maven project)

i.e.

<project>
 ...
 <modules>
  <module>jviewsall</module>
  <module>svgdom</module>
  <module>sdmgui</module>
 </modules>
...
</project>

You would not depend on the aggregator
2008/11/6 jgarrison <jg...@troux.com>

>
> Now I'm really confused.
>
> I have a lot of development experience (20+ years) but am a rank newbie
> when
> it comes to Maven, and I guess I don't understand your response.
>
> The original issue was with the aggregate POM, not sdmgui (or the other two
> libraries).  These are static 3rd party libraries that are always used
> together. I wanted to express this in a POM-packaging POM so that the
> client
> could state a dependency on a single POM and get all three libraries.  This
> may not sound like much of a benefit, but I have several other identical
> situations where there are dozens of libraries that form a dependency
> "set".
>
> --
> View this message in context:
> http://www.nabble.com/Aggregate-POM-for-thirdparty-package---dependencies-not-downloaded-tp20330421p20368015.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Aggregate POM for thirdparty package - dependencies not downloaded

Posted by jgarrison <jg...@troux.com>.
Now I'm really confused.

I have a lot of development experience (20+ years) but am a rank newbie when
it comes to Maven, and I guess I don't understand your response.

The original issue was with the aggregate POM, not sdmgui (or the other two
libraries).  These are static 3rd party libraries that are always used
together. I wanted to express this in a POM-packaging POM so that the client
could state a dependency on a single POM and get all three libraries.  This
may not sound like much of a benefit, but I have several other identical
situations where there are dozens of libraries that form a dependency "set".

-- 
View this message in context: http://www.nabble.com/Aggregate-POM-for-thirdparty-package---dependencies-not-downloaded-tp20330421p20368015.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Aggregate POM for thirdparty package - dependencies not downloaded

Posted by Stephen Connolly <st...@gmail.com>.
Nope....

Here's what I'd do:

%basedir%/sdmgui/pom.xml

<project  xmlns="http://maven.apache.org/POM/4.0.0">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.ilog.jviews</groupId>
    <artifactId>sdmgui</artifactId>
    <version>5.5-SNAPSHOT</version>
    <description>JViews sdmgui library</description>
    <build>
      <plugins>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <forceCreation>true</forceCreation>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>run</goal>
              </goals>
              <configuration>
                <tasks>
                  <copy file="${basedir}/src/jar/${project.artifactId}"

tofile="${project.build.directory}/${project.build.finalName}"
                     overwrite="true"/>
                </tasks>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
</project>

then put sdmgui.jar in

%basedir%/sdmgui/src/jar/sdmgui.jar

What this does is let maven do the build lifecycle as normal for a jar, and
then replaces the empty jar that maven has built with the one you want to
use during the package phase... when you hit the install/deploy phases maven
will then pick up your jar.

An alternative is to just attach the jar to a pom packaging pom.xml

Then you do mvn release:prepare release:perform to push the 5.5 version to
your Nexus

2008/11/6 jgarrison <jg...@troux.com>

>
> I got this to work by adding a <modules>...</modules> section mentioning
> the
> dependencies as modules.
>
> I'm not sure I understand exactly WHY this works, and I HATE not
> understanding why a solution works :-)  My best guess is that the modules
> section describes what this POM "exports" and the dependencies specify how
> the exported artifacts are to be obtained.
>
> Is this anywhere near right?
> --
> View this message in context:
> http://www.nabble.com/Aggregate-POM-for-thirdparty-package---dependencies-not-downloaded-tp20330421p20364286.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Aggregate POM for thirdparty package - dependencies not downloaded

Posted by jgarrison <jg...@troux.com>.
I got this to work by adding a <modules>...</modules> section mentioning the
dependencies as modules.

I'm not sure I understand exactly WHY this works, and I HATE not
understanding why a solution works :-)  My best guess is that the modules
section describes what this POM "exports" and the dependencies specify how
the exported artifacts are to be obtained.

Is this anywhere near right?
-- 
View this message in context: http://www.nabble.com/Aggregate-POM-for-thirdparty-package---dependencies-not-downloaded-tp20330421p20364286.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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