Hello,

 

I've a problem using assembly plugin v. 2.2-SNAPSHOT and don't know, if it's a 
bug or my fault.

 

So, i have a multi-module project.

 

/parent

|

|-war

|-ear

 

And in each module I package alternative configuration files according to 
profile (i.e. each customer has own profile, which points to his own assembly 
descriptor, which describes configuration files, which is right for this 
customer). This is possible with binding the "directory-single" goal on to 
"process-resources" phase.  In order to package config files copyed by assembly 
plugin, both war and assembly plugin have to use the same work directory. War 
plugin use the ${project.build.finalName} and assembly plugin use the 
${baseDirectory} (from assembly descriptor). If I specify equal constant values 
in both options, it works well, but my problem is I want to create a re-usable 
building environment, so I want to specify it like this way 
${project.parent.artifactId} - so, the only difference between war and ear 
modules would be the suffix of package. But if i specify it this way, assembly 
plugin creates new directory with name "war" and puts config files there and 
war plugin package a directory called ${project.parent.artifactId} so without 
my special configuration files. It seems like assembly plugin has a problem 
with resolving variables ...

 

This is my pom files:

 

/parent's pom:

 

<?xml version="1.0"?>

<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/xsd/maven-4.0.0.xsd";>

  <modelVersion>4.0.0</modelVersion>

  <groupId>some.group</groupId>

  <name>Application</name>

  <version>2.0</version>

  <artifactId>application</artifactId>

  <packaging>pom</packaging>

  <modules>

    <module>war</module>

    <module>ear</module>

  </modules>

  <pluginRepositories>

    <pluginRepository>

      <id>apache.org</id>

      <name>Maven Plugin Snapshots</name>

      <url>http://people.apache.org/repo/m2-snapshot-repository</url>

      <releases>

        <enabled>false</enabled>

      </releases>

      <snapshots>

        <enabled>true</enabled>

      </snapshots>

    </pluginRepository>

  </pluginRepositories>

</project>

 

|-war's pom:

 

<?xml version="1.0"?>

<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";>

  <parent>

    <groupId>some.group</groupId>

    <artifactId>application</artifactId>

    <version>2.0</version>

  </parent>

  <modelVersion>4.0.0</modelVersion>

  <artifactId>war</artifactId>

  <packaging>war</packaging>

  <version>2.0</version>

  <name>Application WAR</name>

  <groupId>some.group.war</groupId>

  <profiles>

    <profile>

      <id>debug</id>

      <build>

        <plugins>

          <plugin>

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

            <configuration>

              <descriptors>

                <descriptor>src/main/assembly/debug.xml</descriptor>

              </descriptors>

              <appendAssemblyId>false</appendAssemblyId>

            </configuration>

          </plugin>

        </plugins>

      </build>

      <activation>

        <property>

          <name>debug</name>

        </property>

      </activation>

    </profile>

  </profiles>  

  <build>

    <finalName>zapisy</finalName>

    <plugins>

      <plugin>

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

        <version>2.2-SNAPSHOT</version>

        <configuration>

          <appendAssemblyId>true</appendAssemblyId>

        </configuration>

        <executions>

          <execution>

            <id>copy-configuration</id>

            <phase>process-resources</phase>

            <goals>

              <goal>directory-single</goal>

            </goals>

          </execution>

        </executions>

      </plugin>

    </plugins>

  </build>

... dependencies ...

 

Debug assembly descriptor for war module:

 

<assembly>

  <id>debug</id>

  <formats>

    <format>dir</format>

  </formats>

  <baseDirectory>../${project.parent.artifactId}</baseDirectory>

  <includeBaseDirectory>true</includeBaseDirectory>

  ... some file sets etc. ...

</assembly>

 

|- ear's pom has the same logic as war.

 

 

Thanks for all comments, hints and advices how to solve this problem or how to 
get other solution to work with configuraction files per customer.

 


==========================================
Vaclav Belak
programator
Tel: +420 222 558 202
e-mail: [EMAIL PROTECTED]
www: http://www.sefira.cz

SEFIRA spol. s r.o.
Pocernicka 96
108 00 Praha 10
Czech Republic
IC: 62 90 77 60

Tel: +420-222 558 111
Fax: +420-222 558 555

==========================================

 

Reply via email to