Author: tchemit Date: 2010-01-01 21:08:36 +0100 (Fri, 01 Jan 2010) New Revision: 64 Modified: trunk/maven-jredmine-plugin/pom.xml trunk/maven-jredmine-plugin/src/it/single_failed/invoker.properties trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/AbstractRedmineMojo.java trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/GenerateChangesMojo.java trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/NextVersionMojo.java trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishAttachmentsMojo.java trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishNewsMojo.java trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/UpdateVersionMojo.java trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/announcement/AbstractAnnouncementMojo.java Log: - make runOnceDone works with new maven-helper-plugin api - improve console logs Modified: trunk/maven-jredmine-plugin/pom.xml =================================================================== --- trunk/maven-jredmine-plugin/pom.xml 2010-01-01 18:02:48 UTC (rev 63) +++ trunk/maven-jredmine-plugin/pom.xml 2010-01-01 20:08:36 UTC (rev 64) @@ -210,7 +210,7 @@ <goal>install</goal> <goal>run</goal> </goals> - <phase>validate</phase> + <!--<phase>validate</phase>--> </execution> </executions> </plugin> Modified: trunk/maven-jredmine-plugin/src/it/single_failed/invoker.properties =================================================================== --- trunk/maven-jredmine-plugin/src/it/single_failed/invoker.properties 2010-01-01 18:02:48 UTC (rev 63) +++ trunk/maven-jredmine-plugin/src/it/single_failed/invoker.properties 2010-01-01 20:08:36 UTC (rev 64) @@ -12,10 +12,10 @@ #invoker.mavenOpts=-Dfile.encoding=UTF-16 -Xms32m -Xmx256m # Possible values are "fail-fast" (default), "fail-at-end" and "fail-never" -invoker.failureBehavior=fail-at-end +#invoker.failureBehavior=fail-at-end # The expected result of the build, possible values are "success" (default) and "failure" -#invoker.buildResult=success +invoker.buildResult=failure # A boolean value controlling the -N flag, defaults to "false" #invoker.nonRecursive=false Modified: trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/AbstractRedmineMojo.java =================================================================== --- trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/AbstractRedmineMojo.java 2010-01-01 18:02:48 UTC (rev 63) +++ trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/AbstractRedmineMojo.java 2010-01-01 20:08:36 UTC (rev 64) @@ -246,7 +246,7 @@ serviceInit = false; initOk = false; // if (verbose) { -// getLog().error("could not init Redmine service [" + getRestUrl() + "] with user '" + getRestUsername() + "'", e); + getLog().error("could not init Redmine service [" + getRestUrl() + "] with user '" + getRestUsername() + "'", e); // } // return false; } @@ -257,7 +257,7 @@ boolean r = initReleaseProject(); if (!r) { if (safe) { - throw new MojoExecutionException("the project '" + projectId + "' could not be retrieve from redmine server, goal is skip"); + throw new MojoExecutionException("the project '" + projectId + "' could not be retrieve from redmine server."); } initOk = false; return; @@ -274,7 +274,7 @@ boolean r = initReleaseUser(); if (!r) { if (safe) { - throw new MojoExecutionException("the user '" + this.username + "' could not be retrieve from redmine server, goal is skip"); + throw new MojoExecutionException("the user '" + this.username + "' could not be retrieve from redmine server."); } initOk = false; return; @@ -291,7 +291,7 @@ boolean r = initReleaseVersion(); if (!r) { if (safe) { - throw new MojoExecutionException("the version '" + versionId + "' could not be retrieve from redmine server, goal is skip"); + throw new MojoExecutionException("the version '" + versionId + "' could not be retrieve from redmine server."); } initOk = false; } @@ -311,7 +311,11 @@ getLog().warn("The goal is skip due to the skipGoal flag on"); return false; } - + if (isRunOnce() && isRunOnceDone()) { + getLog().info("skip goal, runOnce flag is on, and was already executed."); + return false; + } + if (!serviceInit) { getLog().error("could not init Redmine service [" + getRestUrl() + "] with user '" + getRestUsername() + "'"); return false; @@ -332,10 +336,6 @@ return false; } - if (isRunOnce() && isRunOnceDone()) { - - } - return true; } Modified: trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/GenerateChangesMojo.java =================================================================== --- trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/GenerateChangesMojo.java 2010-01-01 18:02:48 UTC (rev 63) +++ trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/GenerateChangesMojo.java 2010-01-01 20:08:36 UTC (rev 64) @@ -30,6 +30,7 @@ import org.nuiton.plugin.PluginHelper; import java.io.File; +import java.io.IOException; import java.util.*; import java.util.Map.Entry; @@ -415,20 +416,21 @@ @Override protected boolean checkSkip() { - boolean b = super.checkSkip(); - if (!b) { - return false; - } - if (isRunOnceDone()) { if (!xmlPath.exists()) { - getLog().info("skip goal, work already done."); - return false; + getLog().info("Use already generated " + xmlPath.getName() + " (" + cacheChangesFile + ")"); + + try { + createDirectoryIfNecessary(xmlPath.getParentFile()); + copyFile(cacheChangesFile, xmlPath); + } catch (IOException e) { + throw new IllegalStateException("could not copy already generated file " + xmlPath + " from " + cacheChangesFile); + } } } - - return true; + boolean b = super.checkSkip(); + return b; } @Override @@ -440,25 +442,25 @@ // xmlParent.mkdirs(); // } - if (isRunOnceDone()) { - -// if (!xmlPath.exists()) { - // just copy the already generated changes.xml fil - - getLog().info("Use already generated " + xmlPath.getName() + " (" + cacheChangesFile + ")"); - - copyFile(cacheChangesFile, xmlPath); -// } else { +// if (isRunOnceDone()) { // -// getLog().info("skip goal, work already done."); -// } - return; - } +//// if (!xmlPath.exists()) { +// // just copy the already generated changes.xml fil +// +// getLog().info("Use already generated " + xmlPath.getName() + " (" + cacheChangesFile + ")"); +// +// copyFile(cacheChangesFile, xmlPath); +//// } else { +//// +//// getLog().info("skip goal, work already done."); +//// } +// return; +// } if (releaseVersion.getEffectiveDate() == null) { - getLog().warn("The version " + versionId + " is not effective on redmine, should update effective-date property to today"); - //TODO call the reset service rest/update_version + getLog().debug("The version " + versionId + " is not effective on redmine, should update effective-date property to today"); + releaseVersion.setEffectiveDate(new Date()); } @@ -479,7 +481,7 @@ } catch (RedmineServiceException ex) { collector.clearFilters(); - throw new MojoExecutionException("could not obtains issues for reason " + ex.getMessage(), ex); + throw new MojoExecutionException("could not obtain issues for reason " + ex.getMessage(), ex); } //TODO make some logic checks : version must be @@ -493,7 +495,7 @@ xppWriter.write(writer, doc); - getLog().info("File saved in " + xmlPath.getParentFile().getAbsolutePath()); + getLog().info("File saved in " + xmlPath); // cache result cacheChangesFile = xmlPath; Modified: trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/NextVersionMojo.java =================================================================== --- trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/NextVersionMojo.java 2010-01-01 18:02:48 UTC (rev 63) +++ trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/NextVersionMojo.java 2010-01-01 20:08:36 UTC (rev 64) @@ -117,18 +117,15 @@ return isRunOnce() && !isExecutionRoot(); } - @Override - protected boolean checkSkip() { - boolean b = super.checkSkip(); - if (!b) { - return false; - } - if (isRunOnceDone()) { - getLog().info("runOnce flag is on and goal was already executed, will skip the goal."); - return false; - } - return true; - } +// @Override +// protected boolean checkSkip() { +// if (isRunOnceDone()) { +// getLog().info("runOnce flag is on and goal was already executed, will skip the goal."); +// return false; +// } +// boolean b = super.checkSkip(); +// return b; +// } @Override protected void init() throws Exception { Modified: trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishAttachmentsMojo.java =================================================================== --- trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishAttachmentsMojo.java 2010-01-01 18:02:48 UTC (rev 63) +++ trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishAttachmentsMojo.java 2010-01-01 20:08:36 UTC (rev 64) @@ -168,14 +168,15 @@ @Override protected boolean checkSkip() { +// if (isRunOnceDone()) { +// getLog().info("runOnce flag is on and goal was already executed, will skip the goal."); +// return false; +// } boolean b = super.checkSkip(); if (!b) { return false; } - if (isRunOnceDone()) { - getLog().info("runOnce flag is on and goal was already executed, will skip the goal."); - return false; - } + if (allFiles == null || allFiles.isEmpty()) { getLog().warn("No attachment to publish, will skip the goal."); return false; Modified: trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishNewsMojo.java =================================================================== --- trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishNewsMojo.java 2010-01-01 18:02:48 UTC (rev 63) +++ trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishNewsMojo.java 2010-01-01 20:08:36 UTC (rev 64) @@ -147,18 +147,15 @@ // return true; } - @Override - protected boolean checkSkip() { - boolean b = super.checkSkip(); - if (!b) { - return false; - } - if (isRunOnceDone()) { - getLog().info("runOnce flag is on and goal was already executed, will skip the goal."); - return false; - } - return true; - } +// @Override +// protected boolean checkSkip() { +// if (isRunOnceDone()) { +// getLog().info("runOnce flag is on and goal was already executed, will skip the goal."); +// return false; +// } +// boolean b = super.checkSkip(); +// return b; +// } @Override protected void doAction() throws Exception { Modified: trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/UpdateVersionMojo.java =================================================================== --- trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/UpdateVersionMojo.java 2010-01-01 18:02:48 UTC (rev 63) +++ trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/UpdateVersionMojo.java 2010-01-01 20:08:36 UTC (rev 64) @@ -146,18 +146,15 @@ // return super.init(); } - @Override - protected boolean checkSkip() { - boolean b = super.checkSkip(); - if (!b) { - return false; - } - if (isRunOnceDone()) { - getLog().info("skip goal, runOnce flag is on, and was already executed."); - return false; - } - return true; - } +// @Override +// protected boolean checkSkip() { +// if (isRunOnceDone()) { +// getLog().info("skip goal, runOnce flag is on, and was already executed."); +// return false; +// } +// boolean b = super.checkSkip(); +// return b; +// } @Override protected void doAction() throws Exception { Modified: trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/announcement/AbstractAnnouncementMojo.java =================================================================== --- trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/announcement/AbstractAnnouncementMojo.java 2010-01-01 18:02:48 UTC (rev 63) +++ trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/announcement/AbstractAnnouncementMojo.java 2010-01-01 20:08:36 UTC (rev 64) @@ -238,7 +238,7 @@ "File encoding has not been set, using platform encoding " + templateEncoding + ", i.e. build is platform dependent!"); } - if (introduction == null || introduction.trim().isEmpty()) { + if (StringUtils.isEmpty(introduction)) { introduction = project.getUrl(); } @@ -247,18 +247,15 @@ // return true; } - @Override - protected boolean checkSkip() { - boolean b = super.checkSkip(); - if (!b) { - return false; - } - if (isRunOnceDone()) { - getLog().info("skip goal, runOnce flag is on, and was already executed."); - return false; - } - return true; - } +// @Override +// protected boolean checkSkip() { +//// if (isRunOnceDone()) { +//// getLog().info("skip goal, runOnce flag is on, and was already executed."); +//// return false; +//// } +// boolean b = super.checkSkip(); +// return b; +// } @Override protected void doAction() throws Exception { @@ -277,12 +274,10 @@ File out = new File(templateOutputDirectory, template); - if (verbose) { - getLog().info("destination file " + out); - } + getLog().info("Apply template [" + template + "]"); + getLog().info(" from : " + xmlPath); + getLog().info(" to : " + out); - getLog().info("Creating announcement [" + template + "] from " + xmlPath); - VelocityEngine engine = velocity.getEngine(); engine.setApplicationAttribute("baseDirectory", basedir); @@ -296,7 +291,7 @@ generator.doGenerate(engine, context, out, templateDirectory + "/" + template, templateEncoding); - getLog().info("Created announcement [" + template + "] in " + out); + getLog().debug("Created announcement [" + template + "] in " + out); }