maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Garrison <jim.garri...@nwea.org>
Subject assembly plugin jar-with-dependencies - how to refer to artifact name later?
Date Thu, 02 Jan 2014 20:05:26 GMT
I build a jar-with-dependencies in one execution of the assembly plugin.

In a second execution I use the assembly plugin to package a distributable zip, and need to
substitute the name of the jar-with-dependencies output artifact into a script file that launches
the program.  

Does the assembly plugin put the output artifact name into the environment so it can be substituted
later? If so, what is the variable name? If not, is there another way to accomplish this?

Assembly plugin configuration:

      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>make-jwd</id> <!-- this is used for inheritance merges -->
            <phase>package</phase> <!-- bind to the packaging phase -->
            <configuration>
              <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
              </descriptorRefs>
              <archive>
                <manifest>
                  <mainClass>org.nwea.jhg.dbextract.Driver</mainClass>
                </manifest>
              </archive>
            </configuration>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
          <execution>
            <id>make-zip</id> <!-- this is used for inheritance merges -->
            <phase>package</phase> <!-- bind to the packaging phase -->
            <configuration>
              <descriptors>
                <descriptor>src/main/assembly/zip.xml</descriptor>
              </descriptors>
            </configuration>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

Assembly descriptor:

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd">
  <id>zip</id>
  <formats>
    <format>zip</format>
  </formats>
  <fileSets>
    <fileSet>
      <directory>${project.basedir}/src/main/scripts</directory>
      <outputDirectory>/</outputDirectory>
      <filtered>true</filtered>
    </fileSet>
    <fileSet>
      <directory>${project.basedir}/config</directory>
      <outputDirectory>/</outputDirectory>
    </fileSet>
    <fileSet>
      <directory>${project.build.directory}</directory>
      <outputDirectory>/</outputDirectory>
      <includes>
        <include>*-jar-with-dependencies.jar</include>
      </includes>
    </fileSet>
  </fileSets>
</assembly>

File into which I wish to substitute the name of the jar-with-dependencies artifact:

#!/bin/bash
export DBEX_CMD=dbex
java -jar ${what-do-i-put-here} $*

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


Mime
View raw message