Uploaded image for project: 'Maven Assembly Plugin'
  1. Maven Assembly Plugin
  2. MASSEMBLY-71

Allow an archive base directory that accepts variables

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0, 2.0.1
    • 2.1
    • None
    • None

    Description

      Much like the request in MASSEMBLY-40, I wanted to be able to use profile variables in the specification of the location of items to include in the assembly. I also wanted to be able to specify the base directory when constructing the assembly. That is, I was getting:

      Archive: commons-bin.zip
      Length Method Size Ratio Date Time CRC-32 Name
      -------- ------ ------- ----- ---- ---- ------ ----
      0 Stored 0 0% 02-17-06 07:19 00000000 c:/
      0 Stored 0 0% 09-24-05 15:47 00000000 c:/home/
      0 Stored 0 0% 02-17-06 16:40 00000000 c:/home/glm/
      0 Stored 0 0% 11-18-05 09:23 00000000 c:/home/glm/develop/
      .
      .
      .
      21798 Defl:N 19746 9% 02-18-06 08:22 a9ca0394 c:/home/glm/develop/jar/commons-1.2-SNAPSHOT.jar
      -------- ------- — -------
      21798 19746 9% 12 files

      in the archive, but I wanted:

      Archive: commons-bin.zip
      Length Method Size Ratio Date Time CRC-32 Name
      -------- ------ ------- ----- ---- ---- ------ ----
      0 Stored 0 0% 02-18-06 08:51 00000000 jar/
      21798 Defl:N 19745 9% 02-18-06 08:51 1232e35d jar/commons-1.2-SNAPSHOT.jar
      -------- ------- — -------
      21798 19745 9% 2 files

      I took an approach that achieves both of these goals. I added a archiveBaseDirectory property to the AssemblyMojo that allows the base of the archive to be specified as a parameter as the example shows:

      <project>
      .
      .
      .
      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>2.1-SNAPSHOT</version>
      <configuration>
      <descriptor>${basedir}/assembly.xml</descriptor>
      <finalName>${artifactId}</finalName>
      <archiveBaseDirectory>${buildPath}/${artifactId}</archiveBaseDirectory>
      <outputDirectory>${assemblyPath}/assembly/${artifactId}</outputDirectory>
      <workDirectory>${assemblyPath}/tmp/assembly/${artifactId}</workDirectory>
      </configuration>
      </plugin>

      .
      .
      .
      </project>

      where ${buildpath} comes from my profile:

      <profiles>
      <profile>
      <activation>
      <activeByDefault>true</activeByDefault>
      </activation>
      <id>aentendre</id>
      <properties>
      <buildPath>/home/glm/develop</buildPath>
      </properties>
      </profile>
      </profiles>

      I will attach the patch after I get the JIRA number.

      Attachments

        Activity

          People

            aramirez Allan Q. Ramirez
            glm@hilbertinc.com Gary Murphy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: