r562 - in trunk: . src/main/java/org/nuiton src/site src/site/apt
Author: tchemit Date: 2009-08-29 20:23:17 +0200 (Sat, 29 Aug 2009) New Revision: 562 Added: trunk/src/main/java/org/nuiton/CheckProjectFilesPlugin.java Removed: trunk/src/main/java/org/nuiton/CheckChangelogPlugin.java Modified: trunk/changelog.txt trunk/pom.xml trunk/src/site/apt/index.apt trunk/src/site/site.xml Log: - evolution #26 add a check-project-files goal - fix hudson url in reports - update documentation Modified: trunk/changelog.txt =================================================================== --- trunk/changelog.txt 2009-08-29 17:33:31 UTC (rev 561) +++ trunk/changelog.txt 2009-08-29 18:23:17 UTC (rev 562) @@ -2,9 +2,9 @@ * [FEATURE] improve code + add some usefull methods for plugin * [FEATURE] add some documentation on site + use apt format (no deps to jrst) - * [FEATURE] add a check-changelog-file goal to detect existence of the changelog.txt file for root module of project. + * [FEATURE] #26 add a check-project-files goal to detect existence of the changelog.txt file for root module of project. - -- chemit -- ??? + -- chemit -- Sat, 29 Aug 2009 19:45:05 +0200 maven-helper-plugin (1.0.1) stable; urgency=low Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-08-29 17:33:31 UTC (rev 561) +++ trunk/pom.xml 2009-08-29 18:23:17 UTC (rev 562) @@ -465,7 +465,7 @@ <ciManagement> <system>hudson</system> - <url>http://hudson.nuiton.org/job/${project.artifactId}</url> + <url>http://hudson.nuiton.org/hudson/job/${project.artifactId}</url> </ciManagement> <!--Any mailing lists for the project--> Deleted: trunk/src/main/java/org/nuiton/CheckChangelogPlugin.java =================================================================== --- trunk/src/main/java/org/nuiton/CheckChangelogPlugin.java 2009-08-29 17:33:31 UTC (rev 561) +++ trunk/src/main/java/org/nuiton/CheckChangelogPlugin.java 2009-08-29 18:23:17 UTC (rev 562) @@ -1,63 +0,0 @@ -/* - * *##% - * Maven helper plugin - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * ##%* - */ -package org.nuiton; - -import java.io.File; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.project.MavenProject; - -/** - * Check that the changelog exists on standalone module or root module of a - * multi-module project. - * - * @goal check-changelog-file - * @requiresProject true - * @phase validate - * @author chemit - * @since 1.0.2 - */ -public class CheckChangelogPlugin extends AbstractMojo { - - /** - * Dependance du projet. - * - * @parameter default-value="${project}" - * @required - * @since 1.0.2 - */ - protected MavenProject project; - - @Override - public void execute() throws MojoExecutionException, MojoFailureException { - if (project.isExecutionRoot()) { - File f = new File(project.getBasedir(), "changelog.txt"); - if (!f.exists()) { - throw new MojoExecutionException("the module " + project.getName() + " requires the file " + f.getAbsolutePath()); - } else { - getLog().info("changelog file dectected : " + f.getAbsolutePath()); - } - } else { - getLog().info("skip for module " + project.getName() + " (not a root module)"); - } - } -} Copied: trunk/src/main/java/org/nuiton/CheckProjectFilesPlugin.java (from rev 561, trunk/src/main/java/org/nuiton/CheckChangelogPlugin.java) =================================================================== --- trunk/src/main/java/org/nuiton/CheckProjectFilesPlugin.java (rev 0) +++ trunk/src/main/java/org/nuiton/CheckProjectFilesPlugin.java 2009-08-29 18:23:17 UTC (rev 562) @@ -0,0 +1,103 @@ +/* + * *##% + * Maven helper plugin + * Copyright (C) 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package org.nuiton; + +import java.io.File; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; + +/** + * Check that : + * + * 1) the changelog exists on standalone module or root module of a + * multi-module project. + * 2) any project module has a README.txt and LICENSE.txt file + * + * @goal check-project-files + * @requiresProject true + * @phase validate + * @author chemit + * @since 1.0.2 + */ +public class CheckProjectFilesPlugin extends AbstractMojo { + + /** + * Dependance du projet. + * + * @parameter default-value="${project}" + * @required + * @since 1.0.2 + */ + protected MavenProject project; + /** + * Un flag pour activer le mode verbeux. + * + * @parameter expression="${helper.verbose}" default-value="${maven.verbose}" + * @since 1.0.2 + */ + protected boolean verbose; + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + checkChangelogFile(); + checkReadmeFile(); + checkLicenseFile(); + } + + protected void checkChangelogFile() throws MojoExecutionException { + if (project.isExecutionRoot()) { + File f = new File(project.getBasedir(), "changelog.txt"); + if (!f.exists()) { + throw new MojoExecutionException("the module " + project.getName() + " requires the file " + f.getAbsolutePath()); + } else { + if (verbose) { + getLog().info("changelog file dectected : " + f.getAbsolutePath()); + } + } + } else { + getLog().info("changelog.txt is not required for module " + project.getName() + " (not a root module)"); + } + } + + protected void checkReadmeFile() throws MojoExecutionException { + File f = new File(project.getBasedir(), "README.txt"); + if (!f.exists()) { + throw new MojoExecutionException("the module " + project.getName() + " requires the file " + f.getAbsolutePath()); + } else { + if (verbose) { + getLog().info("readme file dectected : " + f.getAbsolutePath()); + } + } + } + + protected void checkLicenseFile() throws MojoExecutionException { + File f = new File(project.getBasedir(), "LICENSE.txt"); + if (!f.exists()) { + throw new MojoExecutionException("the module " + project.getName() + " requires the file " + f.getAbsolutePath()); + } else { + if (verbose) { + getLog().info("license file dectected : " + f.getAbsolutePath()); + } + } + } +} Property changes on: trunk/src/main/java/org/nuiton/CheckProjectFilesPlugin.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: svn:mergeinfo + Modified: trunk/src/site/apt/index.apt =================================================================== --- trunk/src/site/apt/index.apt 2009-08-29 17:33:31 UTC (rev 561) +++ trunk/src/site/apt/index.apt 2009-08-29 18:23:17 UTC (rev 562) @@ -27,7 +27,7 @@ * {{{add-third-party-mojo.html} helper:add-third-party}} write the licenses of all third-party libraries used in project. - * {{{check-changelog-file-mojo.html} helper:check-changelog-file}} check the root module of project has a changelog.txt file. + * {{{check-project-files-mojo.html} helper:check-project-files}} check the root module of project has a changelog.txt file. * {{{help-mojo.html} helper:help}} display help about the plugin (goals, usage). Modified: trunk/src/site/site.xml =================================================================== --- trunk/src/site/site.xml 2009-08-29 17:33:31 UTC (rev 561) +++ trunk/src/site/site.xml 2009-08-29 18:23:17 UTC (rev 562) @@ -43,7 +43,7 @@ <item name="add-license" href="add-license-mojo.html"/> <item name="add-third-party" href="add-third-party-mojo.html"/> <item name="available-licenses" href="available-licenses-mojo.html"/> - <item name="check-changelog-file" href="check-changelog-file-mojo.html"/> + <item name="check-project-files" href="check-project-files-mojo.html"/> <item name="help" href="help-mojo.html"/> <item name="runJava" href="runJava-mojo.html"/> </item>
participants (1)
-
tchemit@users.nuiton.org