RE: Velocity-based report with project artifacts
Hi Martin, Martin Gainty wrote: > so if you knew how to accomplish this how come you posted that you did not > know how to access project artifacts? as said, your mail triggered my memory and I just wanted to share the result, since I've seen various requests for a generated download page. > I would advise to please be careful with other peoples time..especially > when they are not charging you. That's why I asked on the user's list. If you're not interested or have no time, then don't answer. However, I am thankful you did. It helped me to do the task. Cheers, Jörg - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
RE: Velocity-based report with project artifacts
so if you knew how to accomplish this how come you posted that you did not know how to access project artifacts? I would advise to please be careful with other peoples time..especially when they are not charging you. Regards, Martin __ > To: users@maven.apache.org > From: joerg.schai...@swisspost.com > Subject: RE: Velocity-based report with project artifacts > Date: Tue, 18 Aug 2015 15:33:27 +0200 > > 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 artifacts = new ArrayList(); //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: users@maven.apache.org > >> From: joerg.schai...@swisspost.com > >> 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: users-unsubscr...@maven.apache.org > >> For additional commands, e-mail: users-h...@maven.apache.org > >> > > > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org >
RE: Velocity-based report with project artifacts
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 artifacts = new ArrayList(); //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: users@maven.apache.org >> From: joerg.schai...@swisspost.com >> 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: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
RE: Velocity-based report with project artifacts
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 artifacts = new ArrayList(); //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: users@maven.apache.org > From: joerg.schai...@swisspost.com > 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: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org >