maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Garrison <jim.garri...@nwea.org>
Subject RE: assembly plugin jar-with-dependencies - how to refer to artifact name later?
Date Thu, 02 Jan 2014 22:34:09 GMT
> -----Original Message-----
> From: Ron Wheeler [mailto:rwheeler@artifact-software.com]
> Sent: Thursday, January 02, 2014 2:24 PM
> To: users@maven.apache.org
> Subject: Re: assembly plugin jar-with-dependencies - how to refer to artifact
> name later?
> 
> Why does the name change?
> What is the variable portion?
> 
> Ron
> On 02/01/2014 3:05 PM, Jim Garrison wrote:
> > 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
> >
> >

I think I figured out how to do this. I just used

     ${project.build.finalName}-jar-with-dependencies.jar



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


Mime
View raw message