Hi Martin,
sometime a simple Velocity template is enough. SNippet from my generic about
page:
================ %< ==================
* Generated Artifacts
#set($url=${project.properties.get('site.download')} +
${project.groupId.replaceAll('\.', '/')} + "/")
#set($name=$project.artifact.file.name)
* {{{${url}${name}}${name}}}
#foreach($artifact in $project.attachedArtifacts)
#set($name="${artifact.file.name}")
* {{{${url}${name}}${name}}}
#end
================ %< ==================
Thanks for the hint though, I forgot that you can access the complete
project instance.
Cheers,
Jörg
Martin Gainty wrote:
> http://stackoverflow.com/questions/10454181/how-to-determine-what-artifacts-are-built-from-a-maven-reactor-plan-ie-includi
>
> author suggests to code your own mojo:
> /**
> * @goal list-artifacts
> * @phase verify
> */
> public class ListArtifactsMojo extends AbstractMojo {
>
> /**
> * @parameter default-value="${project}"
> * @required
> * @readonly
> */
> MavenProject project;
>
> public void execute() throws MojoExecutionException,
> MojoFailureException {
> Collection<Artifact> artifacts = new ArrayList<Artifact>(); //create
> empty array artifacts.addAll(project.getAttachedArtifacts()); //add
> attached Artifacts
> //List them out
> for (Artifact artifact : artifacts)
> {
> System.out.println("Artifact: " + artifact);
> }
> } //end execute
> } //end ListArtifactsMojo
>
> i leave contents of plugin.xml as fun exercise:
> https://maven.apache.org/ref/3.2.1/maven-plugin-api/plugin.html
>
> Martin ...
>
>
>
>> To: [email protected]
>> From: [email protected]
>> Subject: Velocity-based report with project artifacts
>> Date: Fri, 14 Aug 2015 09:05:13 +0200
>>
>> Hi,
>>
>> for a report page I'd like to use a velocity template to list all
>> artifacts generated by the current project e.g.
>> - artifact-1.0.jar
>> - artifact-1.0-config.zip
>>
>> Accessing artifactId and version is clear, but the extension of the main
>> artifact is already a problem. Not to speak of all attached artifacts.
>>
>> Is this information available accessing the $project.* hierarchy?
>> Can anyone tell?
>>
>> Cheers,
>> Jörg
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]