Hi,

just did a quick test. The difference is, that wih the parent element present, the build order of the projects change:

Without Parent:

  [INFO] Scanning for projects...
  [INFO] Reactor build order:
  [INFO]   Unnamed - my-test-group:suba:jar:1.0-SNAPSHOT
  [INFO]   Unnamed - my-test-group:subb:jar:1.0-SNAPSHOT
  [INFO]   Unnamed - my-test-group:parent:pom:1.0-SNAPSHOT

With Parent:

  [INFO] Scanning for projects...
  [INFO] Reactor build order:
  [INFO]   Unnamed - my-test-group:parent:pom:1.0-SNAPSHOT
  [INFO]   Unnamed - my-test-group:suba:jar:1.0-SNAPSHOT
  [INFO]   Unnamed - my-test-group:subb:jar:1.0-SNAPSHOT

It seems, the <parent/> relationship is handled like a dependency between the projects and thus the parent is build before the childs.

I have no time now, but I will ask on the dev-list later today why exactly it is handled this way.

For the time being, the proper way of handling this situation would be to create a parent pom separate from the top-level pom. The childs inherit from the parent and the assembly is build in the top-level pom:
  .
  |-- pom.xml      <---- Top-Level building assembly
  |-- src
  |   `-- main
  |       `-- assembly
  |           `-- developer-assembly.xml
  |-- parent
  |   `-- pom.xml  <---- Child inherit from this
  |-- suba
  |   |-- pom.xml
  |   `-- src
  |       `-- main
  |           `-- java
  |               `-- TestClass.java
  `-- subb
      |-- pom.xml
      `-- src
          `-- main
              `-- java
                  `-- TestClass.java

-Tim

Evan Toliopoulos schrieb:
Am back from a long weekend and have isolated the difference between what works and what doesn't. My child pom.xml files specify the <parent> element so that it pulls information including version number from the parent pom.xml.

I created a project exactly as per your (Tim's) project structure and it worked.

Then I modified the suba/pom.xml and subb.xml to have <parent> elements and removed <version> elements and it stop working and gave this error:

   [ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------ [INFO] Failed to create assembly: Artifact: my-test-group:subb:jar:1.0-SNAPSHOT (included by module) does not have an artifact with a file. Please ensure the package phase is run before the assembly is generated.

My child POM files are:

suba/pom.xml:

 <project>

   <parent>
       <groupId>my-test-group</groupId>
       <artifactId>parent</artifactId>
       <version>1.0-SNAPSHOT</version>
       <relativePath>../pom.xml</relativePath>
</parent> <modelVersion>4.0.0</modelVersion>
   <groupId>my-test-group</groupId>
   <artifactId>suba</artifactId>
 </project>

subv/pom.xml

 <project>

   <parent>
       <groupId>my-test-group</groupId>
       <artifactId>parent</artifactId>
       <version>1.0-SNAPSHOT</version>
       <relativePath>../pom.xml</relativePath>
</parent> <modelVersion>4.0.0</modelVersion>
   <groupId>my-test-group</groupId>
   <artifactId>subb</artifactId>

   <dependencies>
     <dependency>
       <groupId>my-test-group</groupId>
       <artifactId>suba</artifactId>
       <version>1.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>


Thanks,
Evan


Tim Kettler wrote:
It's working for me with this test project:
  .
  |-- pom.xml
  |-- src
  |   `-- main
  |       `-- assembly
  |           `-- assembly.xml
  |-- suba
  |   |-- pom.xml
  |   `-- src
  |       `-- main
  |           `-- java
  |               `-- TestClass.java
  `-- subb
      |-- pom.xml
      `-- src
          `-- main
              `-- java
                  `-- TestClass.java

pom.xml:

  <project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>my-test-group</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <modules>
      <module>suba</module>
      <module>subb</module>
    </modules>

    <build>
      <plugins>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
      <inherited>false</inherited>
          <configuration>
        <descriptors>
          <descriptor>src/main/assembly/assembly.xml</descriptor>
            </descriptors>
          </configuration>
          <executions>
            <execution>
              <id>make-assembly</id>
              <phase>package</phase>
              <goals>
                <goal>single</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
  </project>

suba/pom.xml:

  <project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>my-test-group</groupId>
    <artifactId>suba</artifactId>
    <version>1.0-SNAPSHOT</version>
  </project>

subb/pom.xml:

  <project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>my-test-group</groupId>
    <artifactId>subb</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
      <dependency>
        <groupId>my-test-group</groupId>
        <artifactId>suba</artifactId>
        <version>1.0-SNAPSHOT</version>
      </dependency>
    </dependencies>
  </project>

src/main/assembly/assembly.xml:

  <?xml version="1.0" encoding="UTF-8"?>
  <assembly>
    <formats>
      <format>zip</format>
      <format>tar.gz</format>
    </formats>

    <includeBaseDirectory>true</includeBaseDirectory>

    <moduleSets>
      <moduleSet>
        <binaries>
          <includeDependencies>true</includeDependencies>
          <unpack>false</unpack>
          <outputDirectory>lib</outputDirectory>
          <fileMode>664</fileMode>
          <directoryMode>775</directoryMode>
        </binaries>
      </moduleSet>
    </moduleSets>
  </assembly>

I tested this with an empty local repository to ensure only released plugins are used. Here's the relevant output from 'mvn clean install':

[INFO] [assembly:single {execution: make-assembly}]
[INFO] Reading assembly descriptor: /home/tik/Develop/maven-testprojects/pomassembly/src/main/assembly/developer-assembly.xml [WARNING] NOTE: Currently, inclusion of module dependencies may produce unpredictable results if a version conflict occurs.
[INFO] Processing DependencySet (output=lib)
[INFO] Processing DependencySet (output=lib)
[INFO] Building zip: /home/tik/Develop/maven-testprojects/pomassembly/target/parent-1.0-SNAPSHOT.zip [WARNING] NOTE: Currently, inclusion of module dependencies may produce unpredictable results if a version conflict occurs.
[INFO] Processing DependencySet (output=lib)
[INFO] Processing DependencySet (output=lib)
[INFO] Building tar : /home/tik/Develop/maven-testprojects/pomassembly/target/parent-1.0-SNAPSHOT.tar.gz
[INFO] [install:install]
[INFO] Installing /home/tik/Develop/maven-testprojects/pomassembly/pom.xml to /home/tik/Develop/maven-testprojects/repository/my-test-group/parent/1.0-SNAPSHOT/parent-1.0-SNAPSHOT.pom [INFO] Installing /home/tik/Develop/maven-testprojects/pomassembly/target/parent-1.0-SNAPSHOT.zip to /home/tik/Develop/maven-testprojects/repository/my-test-group/parent/1.0-SNAPSHOT/parent-1.0-SNAPSHOT.zip [INFO] Installing /home/tik/Develop/maven-testprojects/pomassembly/target/parent-1.0-SNAPSHOT.tar.gz to /home/tik/Develop/maven-testprojects/repository/my-test-group/parent/1.0-SNAPSHOT/parent-1.0-SNAPSHOT.tar.gz

Hope this helps
-Tim

Evan Toliopoulos schrieb:
Thanks,

Though it still is not working.  I get the following error:

Failed to create assembly: Artifact: com.emagineinternational:sms-transceiver-mq:jar:6.5.1-SNAPSHOT (included by module) does not have an artifact with a file. Please ensure the package phase is run before the assembly is generated.

What you have described is what we already do for maven projects that get built into a jar as well as have a tar.gz assembly and it works fine for those projects.

The difference with this project is that is a parent project which does not have any source code of it's own. It is declared as a <packaging>pom</packaging> project that has a number of child <module>...</module> projects. We then have an assembly descriptor that assembles all the child project jars as well as any dependencies into a tar.gz archive ready for distribution.

Any further ideas?

BTW, our assembly descriptor looks like:

<?xml version="1.0" encoding="UTF-8"?>
<assembly>
     <formats>
       <format>zip</format>
       <format>tar.gz</format>
   </formats>
     <includeBaseDirectory>true</includeBaseDirectory>

   <moduleSets>
       <moduleSet>
           <binaries>
               <includeDependencies>true</includeDependencies>
               <unpack>false</unpack>
               <outputDirectory>lib</outputDirectory>
               <fileMode>664</fileMode>
               <directoryMode>775</directoryMode>
           </binaries>
       </moduleSet>
   </moduleSets>

   <fileSets>
       <fileSet>
           <directory>src/main/etc</directory>
           <outputDirectory>etc</outputDirectory>
           <fileMode>775</fileMode>
           <directoryMode>775</directoryMode>
       </fileSet>
       <fileSet>
           <directory>src/main/config</directory>
           <outputDirectory>conf</outputDirectory>
           <fileMode>664</fileMode>
           <directoryMode>775</directoryMode>
       </fileSet>
   </fileSets>

</assembly>




Tim Kettler wrote:
Hi,

Evan Toliopoulos schrieb:
Hi,

I am having trouble deploying a 'tar.gz' assembly of a parent project
using the deploy goal.

The parent project has a number of child module projects.

Essentially I am running the following on the parent project:

    mvn package assembly:assembly deploy

What is happening here is this: First 'assembly:assembly' is executed as a standalone plugin goal on the command line, which builds the assembly. Then as the second step the 'deploy' phase is invoked on your project, and since these two steps are two completely separate executions, the second run (deploy) knows nothing about the previously build assembly.

What you should do instead, is to attach the assembly-plugin execution to the build lifecycle of your project, so it gets executed automatically when you run 'mvn deploy' for example. To do this modify your plugin configuration like this:

  [...]
  <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <inherited>false</inherited>
    <configuration>
      <descriptors>
<descriptor>src/main/assembly/developer-assembly.xml</descriptor>
      </descriptors>
    </configuration>
    <executions>
      <execution>
        <id>make-assembly</id>
        <phase>package</phase>
        <goals>
          <goal>single</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
  [...]

This executes the assembly-plugin as part of the 'package' phase of the project and attaches the built assembly to your project, the deploy plugin then will automatically pick up this additional artifact and deploy it to the repository.

-Tim

and what is happening is that all the child jars are being deployed but
the important artifact - the parent 'tar.gz' assembly is not. The
interesting thing is that the 'tar.gz' file is being created - just not
deployed.

Any ideas as to what I am doing wrong?

Thanks,
Evan Toliopoulos
P.S.  My parent pom.xml follows...
-------------------
<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
      <modelVersion>4.0.0</modelVersion>
    <groupId>com.emagineinternational</groupId>
    <artifactId>sms-transceiver</artifactId>
    <packaging>pom</packaging>
    <version>6.5.0-SNAPSHOT</version>
    <name>sms-transceiver</name>
    <url>http://maven.apache.org</url>

    <dependencies>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.3.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <modules>
        <module>./sms-transceiver-config-jaxb</module>
        <module>./sms-transceiver-common</module>
        <module>./sms-transceiver-config</module>
        <module>./sms-transceiver-mq</module>
        <module>./sms-transceiver-db-receiver</module>
        <module>./sms-transceiver-db-transmitter</module>
        <module>./sms-transceiver-smpp-receiver</module>
        <module>./sms-transceiver-smpp-transmitter</module>
    </modules>

    <build>
        <plugins>
                    <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
                        <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.0-beta-5</version>
                <configuration>
<tagBase>svn://svn.emagineinternational.com/tags/sms-transceiver</tagBase>
                </configuration>
            </plugin>
                    </plugins>
    </build>


    <profiles>

        <profile>
            <id>parent-developer-assembly-profile</id>
            <activation>
                <property>
                    <name>developer.profile</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <inherited>false</inherited>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <descriptors>
<descriptor>src/main/assembly/developer-assembly.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
                <profile>
            <id>parent-release-assembly-profile</id>
            <activation>
                <property>
                    <name>release.profile</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <inherited>false</inherited>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <descriptors>
<descriptor>src/main/assembly/release-assembly.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
            </profiles>


    <repositories>
        <repository>
            <id>EmagineMavenRepository</id>
            <url>http://angie/maven-repository</url>
        </repository>
    </repositories>
        <distributionManagement>
        <repository>
            <id>emagine-repository</id>
            <name>Emagine Repository</name>
            <url>scp://angie/opt/emagine-repository/release</url>
        </repository>
        <snapshotRepository>
            <id>emagine-repository</id>
            <name>Emagine Repository</name>
            <url>scp://angie/opt/emagine-repository/snapshot</url>
        </snapshotRepository>
    </distributionManagement>

    <scm>
<connection>scm:svn:svn://svn.emagineinternational.com/trunk/sms-transceiver</connection> <developerConnection>scm:svn:svn://svn.emagineinternational.com/trunk/sms-transceiver</developerConnection> <url>svn://svn.emagineinternational.com/trunk/sms-transceiver</url>
    </scm>
    </project>

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


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



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


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



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


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

Reply via email to