On 14/12/2007, ewhauser <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> I wrote a Mojo that generates a wrapper.conf file for installing ActiveMQ
> as
> a service.  One of the things it generates is the class path:
>
> wrapper.java.classpath.1=../lib/wrapper.jar
> wrapper.java.classpath.2=../lib/activemq-all-5.0-SNAPSHOT.jar
> wrapper.java.classpath.3=../lib/activemq-core-5.0-SNAPSHOT.jar
> wrapper.java.classpath.4=../lib/commons-logging-api-1.1.jar
> wrapper.java.classpath.5=../lib/camel-core-1.2.0.jar
> ...
>
> This works for except when using the assembly:assembly command, the files
> are archived as their actual snapshot filename (i.e.
> activeio-core-3.1-20071214.010031-268.jar,
> activemq-core-5.0-20071208.031023-17.jar).  I am retrieving the classpath
> references by looping over MavenProject#getRuntimeArtifacts and calling
> Artifact#getFile#getName.
>
> I am trying to figure out how to get the true snapshot filename, so so it
> matches what is bundled through the assembly plugin.  Any help would be
> appreciated.


you could get the SNAPSHOT version (without the build timestamp) by using:

        if( artifact.isSnapshot() ) {
            try {
                return artifact.getSelectedVersion().toString();
            }
            catch( Exception e ) {
                // fall thru
            }
        }

        return artifact.getVersion();

and then use this with other artifact methods to reconstruct the right
name... (ie. artifactId-version.type)

or, if you inject the local repository parameter:

    /**
     * The local Maven repository.
     *
     * @parameter expression="${localRepository}"
     * @required
     * @readonly
     */
    private ArtifactRepository localRepository;

then you could use localRepository.pathOf(artifact) which I think will also
include the non-timestamp version
( you'd just need to trim off the leading path to get the base filename )

HTH

Thanks.
> --
> View this message in context:
> http://www.nabble.com/Resolving-snapshot-filenames-from-Mojo-tp14338324s177p14338324.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Cheers, Stuart

Reply via email to