Maven-helper-plugin-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
October 2009
- 1 participants
- 19 discussions
Author: tchemit
Date: 2009-10-09 13:01:08 +0200 (Fri, 09 Oct 2009)
New Revision: 609
Added:
tags/maven-helper-plugin-1.0.3/
Log:
[maven-scm] copy for tag maven-helper-plugin-1.0.3
Property changes on: tags/maven-helper-plugin-1.0.3
___________________________________________________________________
Added: svn:ignore
+ target
Added: svn:mergeinfo
+
1
0
Author: tchemit
Date: 2009-10-09 13:00:56 +0200 (Fri, 09 Oct 2009)
New Revision: 608
Modified:
trunk/pom.xml
Log:
[maven-release-plugin] prepare release maven-helper-plugin-1.0.3
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-10-09 10:57:16 UTC (rev 607)
+++ trunk/pom.xml 2009-10-09 11:00:56 UTC (rev 608)
@@ -10,7 +10,7 @@
<groupId>org.nuiton</groupId>
<artifactId>maven-helper-plugin</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.0.3</version>
<dependencies>
@@ -289,9 +289,9 @@
</mailingLists>
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/maven-helper-plugin/trunk</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/maven-helper-plugin/trunk</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/maven-helper-plugin/trunk</url>
+ <connection>scm:svn:http://svn.nuiton.org/svn/maven-helper-plugin/tags/maven-helper-plu…</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/maven-helper-plugin/tags/maven-helper-plu…</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/maven-helper-plugin/tags/maven-he…</url>
</scm>
<issueManagement>
1
0
r607 - in trunk/src: main/java/org/nuiton/helper/plugin main/java/org/nuiton/license main/java/org/nuiton/license/plugin main/java/org/nuiton/util site/apt
by tchemit@users.nuiton.org 09 Oct '09
by tchemit@users.nuiton.org 09 Oct '09
09 Oct '09
Author: tchemit
Date: 2009-10-09 12:57:16 +0200 (Fri, 09 Oct 2009)
New Revision: 607
Modified:
trunk/src/main/java/org/nuiton/helper/plugin/CheckProjectFilesPlugin.java
trunk/src/main/java/org/nuiton/license/JarLicenseResolver.java
trunk/src/main/java/org/nuiton/license/License.java
trunk/src/main/java/org/nuiton/license/LicenseFactory.java
trunk/src/main/java/org/nuiton/license/LicenseResolver.java
trunk/src/main/java/org/nuiton/license/plugin/AvailableLicensesPlugin.java
trunk/src/main/java/org/nuiton/license/plugin/LicensePlugin.java
trunk/src/main/java/org/nuiton/license/plugin/ThirdPartyPlugin.java
trunk/src/main/java/org/nuiton/util/DependencyUtil.java
trunk/src/main/java/org/nuiton/util/FileUpdater.java
trunk/src/main/java/org/nuiton/util/FileUpdaterHelper.java
trunk/src/main/java/org/nuiton/util/MirroredFileUpdater.java
trunk/src/main/java/org/nuiton/util/PluginHelper.java
trunk/src/main/java/org/nuiton/util/PluginIOContext.java
trunk/src/main/java/org/nuiton/util/SourceEntry.java
trunk/src/main/java/org/nuiton/util/VelocityTemplateGenerator.java
trunk/src/main/java/org/nuiton/util/package.html
trunk/src/site/apt/index.apt
Log:
prepare compatibility release 1.0.3 (1.1.0 will remove all obsolote codes)
Modified: trunk/src/main/java/org/nuiton/helper/plugin/CheckProjectFilesPlugin.java
===================================================================
--- trunk/src/main/java/org/nuiton/helper/plugin/CheckProjectFilesPlugin.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/helper/plugin/CheckProjectFilesPlugin.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -37,7 +37,7 @@
* @phase validate
* @author chemit
* @since 1.0.2
- * @deprecated since 1.1.0, reuse just a enforcer plugin to check those files.
+ * @deprecated since 1.0.3, reuse just a enforcer plugin to check those files. (removed in 1.1.0)
*/
@Deprecated
public class CheckProjectFilesPlugin extends AbstractPlugin {
Modified: trunk/src/main/java/org/nuiton/license/JarLicenseResolver.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/JarLicenseResolver.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/license/JarLicenseResolver.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -36,7 +36,7 @@
*
* @author chemit
* @see LicenseResolver
- * @deprecated since 1.0.3, move all license stuff in maven-license-plugin
+ * @deprecated since 1.0.3, move all license stuff in maven-license-plugin (removed in 1.1.0)
*/
@Deprecated
public class JarLicenseResolver extends LicenseResolver {
Modified: trunk/src/main/java/org/nuiton/license/License.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/License.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/license/License.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -32,7 +32,7 @@
* The model of a license.
*
* @author chemit
- * @deprecated since 1.0.3, move all license stuff in maven-license-plugin
+ * @deprecated since 1.0.3, move all license stuff in maven-license-plugin (removed in 1.1.0)
*/
@Deprecated
public class License {
Modified: trunk/src/main/java/org/nuiton/license/LicenseFactory.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/LicenseFactory.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/license/LicenseFactory.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -34,7 +34,7 @@
* To obtain an instance of a {@link org.nuiton.license.LicenseFactory} use the method {@link #newInstance(String[])}.
*
* @author chemit
- * @deprecated since 1.0.3, move all license stuff in maven-license-plugin
+ * @deprecated since 1.0.3, move all license stuff in maven-license-plugin (removed in 1.1.0)
*/
@Deprecated
public class LicenseFactory {
Modified: trunk/src/main/java/org/nuiton/license/LicenseResolver.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/LicenseResolver.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/license/LicenseResolver.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -46,7 +46,7 @@
* </pre>
*
* @author chemit
- * @deprecated since 1.0.3, move all license stuff in maven-license-plugin
+ * @deprecated since 1.0.3, move all license stuff in maven-license-plugin (removed in 1.1.0)
*/
@Deprecated
public class LicenseResolver {
Modified: trunk/src/main/java/org/nuiton/license/plugin/AvailableLicensesPlugin.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/AvailableLicensesPlugin.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/license/plugin/AvailableLicensesPlugin.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -33,7 +33,7 @@
* @author chemit
* @goal available-licenses
* @requiresProject false
- * @deprecated since 1.0.3, move all license stuff in maven-license-plugin
+ * @deprecated since 1.0.3, move all license stuff in maven-license-plugin (removed in 1.1.0)
*/
@Deprecated
public class AvailableLicensesPlugin extends AbstractMojo {
Modified: trunk/src/main/java/org/nuiton/license/plugin/LicensePlugin.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/LicensePlugin.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/license/plugin/LicensePlugin.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -34,7 +34,7 @@
* @phase generate-resources
* @requiresProject true
* @requiresDependencyResolution compile
- * @deprecated since 1.0.3, move all license stuff in maven-license-plugin
+ * @deprecated since 1.0.3, move all license stuff in maven-license-plugin (removed in 1.1.0)
*/
@Deprecated
public class LicensePlugin extends org.nuiton.plugin.AbstractPlugin {
Modified: trunk/src/main/java/org/nuiton/license/plugin/ThirdPartyPlugin.java
===================================================================
--- trunk/src/main/java/org/nuiton/license/plugin/ThirdPartyPlugin.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/license/plugin/ThirdPartyPlugin.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -52,7 +52,7 @@
* @phase generate-resources
* @requiresDependencyResolution test
* @requiresProject true
- * @deprecated since 1.0.3, move all license stuff in maven-license-plugin
+ * @deprecated since 1.0.3, move all license stuff in maven-license-plugin (removed in 1.1.0)
*/
@Deprecated
public class ThirdPartyPlugin extends AbstractPlugin {
Modified: trunk/src/main/java/org/nuiton/util/DependencyUtil.java
===================================================================
--- trunk/src/main/java/org/nuiton/util/DependencyUtil.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/util/DependencyUtil.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -34,7 +34,7 @@
*
* @author chemit
* @since 0.5
- * @deprecated since 1.0.3, move to package org.nuiton.plugin
+ * @deprecated since 1.0.3, move to package org.nuiton.plugin (removed in 1.1.0)
*/
@Deprecated
public class DependencyUtil {
Modified: trunk/src/main/java/org/nuiton/util/FileUpdater.java
===================================================================
--- trunk/src/main/java/org/nuiton/util/FileUpdater.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/util/FileUpdater.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -28,7 +28,7 @@
* use {@link #isFileUpToDate(java.io.File)} to determine if a file is up to date.
*
* @author chemit
- * @deprecated since 1.0.3, move to package org.nuiton.plugin
+ * @deprecated since 1.0.3, move to package org.nuiton.plugin (removed in 1.1.0)
*/
@Deprecated
Modified: trunk/src/main/java/org/nuiton/util/FileUpdaterHelper.java
===================================================================
--- trunk/src/main/java/org/nuiton/util/FileUpdaterHelper.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/util/FileUpdaterHelper.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -24,7 +24,7 @@
/**
* @author chemit
- * @deprecated since 1.0.3, move to package org.nuiton.plugin
+ * @deprecated since 1.0.3, move to package org.nuiton.plugin (removed in 1.1.0)
*/
@Deprecated
public class FileUpdaterHelper {
Modified: trunk/src/main/java/org/nuiton/util/MirroredFileUpdater.java
===================================================================
--- trunk/src/main/java/org/nuiton/util/MirroredFileUpdater.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/util/MirroredFileUpdater.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -29,7 +29,7 @@
* Simple base implementation of a {@link FileUpdater} for an updater with a sourcedir and a destinationdir.
*
* @author chemit
- * @deprecated since 1.0.3, move to package org.nuiton.plugin
+ * @deprecated since 1.0.3, move to package org.nuiton.plugin (removed in 1.1.0)
*/
@Deprecated
public class MirroredFileUpdater implements FileUpdater {
Modified: trunk/src/main/java/org/nuiton/util/PluginHelper.java
===================================================================
--- trunk/src/main/java/org/nuiton/util/PluginHelper.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/util/PluginHelper.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -57,7 +57,7 @@
* Une classe pour mutualiser toutes les méthodes utiles pour un plugin.
*
* @author chemit
- * @deprecated since 1.0.3, move to package org.nuiton.plugin
+ * @deprecated since 1.0.3, move to package org.nuiton.plugin (removed in 1.1.0)
*/
@Deprecated
public class PluginHelper {
Modified: trunk/src/main/java/org/nuiton/util/PluginIOContext.java
===================================================================
--- trunk/src/main/java/org/nuiton/util/PluginIOContext.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/util/PluginIOContext.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -32,7 +32,7 @@
*
* @author chemit
* @since 1.0.1
- * @deprecated since 1.0.3, move to package org.nuiton.plugin
+ * @deprecated since 1.0.3, move to package org.nuiton.plugin (removed in 1.1.0)
*/
@Deprecated
public class PluginIOContext {
Modified: trunk/src/main/java/org/nuiton/util/SourceEntry.java
===================================================================
--- trunk/src/main/java/org/nuiton/util/SourceEntry.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/util/SourceEntry.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -44,7 +44,7 @@
* to expose his methods.</b>
*
* @author tony
- * @deprecated since 1.0.3, move to package org.nuiton.plugin
+ * @deprecated since 1.0.3, move to package org.nuiton.plugin (removed in 1.1.0)
*/
@Deprecated
public class SourceEntry {
Modified: trunk/src/main/java/org/nuiton/util/VelocityTemplateGenerator.java
===================================================================
--- trunk/src/main/java/org/nuiton/util/VelocityTemplateGenerator.java 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/util/VelocityTemplateGenerator.java 2009-10-09 10:57:16 UTC (rev 607)
@@ -53,7 +53,7 @@
*
* @author chemit
* @since 1.3
- * @deprecated since 1.0.3, move to package org.nuiton.plugin
+ * @deprecated since 1.0.3, move to package org.nuiton.plugin (removed in 1.1.0)
*/
@Deprecated
public class VelocityTemplateGenerator {
Modified: trunk/src/main/java/org/nuiton/util/package.html
===================================================================
--- trunk/src/main/java/org/nuiton/util/package.html 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/main/java/org/nuiton/util/package.html 2009-10-09 10:57:16 UTC (rev 607)
@@ -1,5 +1,5 @@
<html>
<body>
-<h1>Deprecated, will be remove before version 2.0.0</h1>
+<h1>Deprecated, will be remove before version 1.1.0</h1>
</body>
</html>
\ No newline at end of file
Modified: trunk/src/site/apt/index.apt
===================================================================
--- trunk/src/site/apt/index.apt 2009-10-09 10:50:02 UTC (rev 606)
+++ trunk/src/site/apt/index.apt 2009-10-09 10:57:16 UTC (rev 607)
@@ -29,11 +29,11 @@
* {{{help-mojo.html} helper:help}} display help about the plugin (goals, usage).
- * {{{add-license-mojo.html} helper:add-license}} *DEPRECATED* add license file and third-party files to classpath (generate them if necessary).
+ * {{{add-license-mojo.html} helper:add-license}} <DEPRECATED> add license file and third-party files to classpath (generate them if necessary).
- * {{{add-third-party-mojo.html} helper:add-third-party}} *DEPRECATED* write the licenses of all third-party libraries used in project.
+ * {{{add-third-party-mojo.html} helper:add-third-party}} <DEPRECATED> write the licenses of all third-party libraries used in project.
- * {{{available-licenses-mojo.html} helper:available-licenses}} *DEPRECATED* display the known licenses of the plugin.
+ * {{{available-licenses-mojo.html} helper:available-licenses}} <DEPRECATED> display the known licenses of the plugin.
Consult the {{{mojo-usages.html}usages}} page to have more details of mojos.
1
0
Author: tchemit
Date: 2009-10-09 12:50:02 +0200 (Fri, 09 Oct 2009)
New Revision: 606
Modified:
trunk/pom.xml
Log:
- avoid aggregate javadoc on site generation
- avoid execution in pluginManagement
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-10-09 09:46:13 UTC (rev 605)
+++ trunk/pom.xml 2009-10-09 10:50:02 UTC (rev 606)
@@ -338,9 +338,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <maven.test.testFailureIgnore>false</maven.test.testFailureIgnore>
<maven.test.skip>false</maven.test.skip>
- <maven.test.forkMode>once</maven.test.forkMode>
<!-- to activate generation of reports and javadoc when doing a site -->
<maven.reports.generate>true</maven.reports.generate>
@@ -380,6 +378,7 @@
</executions>
</plugin>
+ <!-- will be removed before 2.0.0 (all will be in maven-license-plugin) -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
@@ -444,29 +443,12 @@
<version>2.4.3</version>
<configuration>
<skip>${maven.test.skip}</skip>
- <testFailureIgnore>${maven.test.testFailureIgnore}</testFailureIgnore>
- <forkMode>${maven.test.forkMode}</forkMode>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1</version>
- <inherited>true</inherited>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- <execution>
- <id>attach-test-sources</id>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
</plugin>
<plugin>
@@ -643,21 +625,6 @@
</taglet>
</taglets>
</configuration>
- <executions>
- <execution>
- <id>attach-javadocs</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- <execution>
- <id>attach-test-javadocs</id>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
-
</plugin>
<plugin>
@@ -708,6 +675,7 @@
<version>${javadoc.version}</version>
<configuration>
<quiet>true</quiet>
+ <!--<skip>true</skip>-->
<docencoding>${project.build.sourceEncoding}</docencoding>
<encoding>${project.build.sourceEncoding}</encoding>
<charset>${project.reporting.outputEncoding}</charset>
@@ -876,6 +844,14 @@
</taglet>
</taglets>
</configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>javadoc</report>
+ <report>test-javadoc</report>
+ </reports>
+ </reportSet>
+ </reportSets>
</plugin>
<!-- changelog:changelog
@@ -963,10 +939,11 @@
<executions>
<execution>
<id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ <goal>test-jar</goal>
+ </goals>
</execution>
- <execution>
- <id>attach-test-sources</id>
- </execution>
</executions>
</plugin>
@@ -976,10 +953,11 @@
<executions>
<execution>
<id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ <goal>test-jar</goal>
+ </goals>
</execution>
- <execution>
- <id>attach-test-javadocs</id>
- </execution>
</executions>
</plugin>
1
0
Author: tchemit
Date: 2009-10-09 11:46:13 +0200 (Fri, 09 Oct 2009)
New Revision: 605
Modified:
trunk/src/main/java/org/nuiton/plugin/PluginHelper.java
Log:
add usefull method splitAndTrim
Modified: trunk/src/main/java/org/nuiton/plugin/PluginHelper.java
===================================================================
--- trunk/src/main/java/org/nuiton/plugin/PluginHelper.java 2009-10-09 08:18:25 UTC (rev 604)
+++ trunk/src/main/java/org/nuiton/plugin/PluginHelper.java 2009-10-09 09:46:13 UTC (rev 605)
@@ -123,6 +123,23 @@
}
/**
+ * Split the given {@code text} using the {@code separator} and trim
+ * each part of result.
+ *
+ * @param txt text to split
+ * @param separator the split separator
+ * @return the splited text with trimmed parts.
+ * @since 1.1.0
+ */
+ public static String[] splitAndTrim(String txt, String separator) {
+ String[] result = txt.split(separator);
+ for (int i = 0, j = result.length; i < j; i++) {
+ result[i] = result[i].trim();
+ }
+ return result;
+ }
+
+ /**
* Prefix the lines of the given content with a given prefix.
*
* @param prefix prefix to add on each line of text
1
0
Author: tchemit
Date: 2009-10-09 10:18:25 +0200 (Fri, 09 Oct 2009)
New Revision: 604
Modified:
trunk/pom.xml
Log:
bump log4j and maven-plugin-plugin versions
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-10-09 07:21:10 UTC (rev 603)
+++ trunk/pom.xml 2009-10-09 08:18:25 UTC (rev 604)
@@ -206,7 +206,7 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <version>1.2.9</version>
+ <version>1.2.14</version>
<scope>test</scope>
</dependency>
@@ -679,7 +679,7 @@
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
- <version>2.5</version>
+ <version>2.5.1</version>
</plugin>
<plugin>
@@ -931,7 +931,7 @@
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
- <version>2.5</version>
+ <version>2.5.1</version>
</plugin>
<plugin>
1
0
r603 - in trunk/src: main/java/org/nuiton/helper/plugin site/apt
by tchemit@users.nuiton.org 09 Oct '09
by tchemit@users.nuiton.org 09 Oct '09
09 Oct '09
Author: tchemit
Date: 2009-10-09 09:21:10 +0200 (Fri, 09 Oct 2009)
New Revision: 603
Modified:
trunk/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java
trunk/src/site/apt/mojo-usages.apt
Log:
fix javadoc + improve documentation
Modified: trunk/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java
===================================================================
--- trunk/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java 2009-10-03 08:58:29 UTC (rev 602)
+++ trunk/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java 2009-10-09 07:21:10 UTC (rev 603)
@@ -17,6 +17,7 @@
* <pre>
* usernameOut
* passwordOut
+ * privateKeyOut
* passphraseOut
* </pre>
*
@@ -60,7 +61,7 @@
/**
* The name of the property where to export the username of the server.
* <p/>
- * <b>Note:</> If not set - then no export of the username of the server.
+ * <b>Note:</b> If not set - then no export of the username of the server.
*
* @parameter
* @since 1.1.0
@@ -69,9 +70,9 @@
/**
* The name of the property where to export the password of the server.
* <p/>
- * <b>Note:</> If not set - then no export of the password of the server.
+ * <b>Note:</b> If not set - then no export of the password of the server.
* <p/>
- * <b>Note:</> If the password is crypted (since maven 2.1.0) then decrypt it.
+ * <b>Note:</b> If the password is crypted (since maven 2.1.0) then decrypt it.
*
* @parameter
* @since 1.1.0
@@ -80,9 +81,9 @@
/**
* The name of the property where to export the passphrase of the server.
* <p/>
- * <b>Note:</> If not set - then no export of the passphrase of the server.
+ * <b>Note:</b> If not set - then no export of the passphrase of the server.
* <p/>
- * <b>Note:</> If the passphrase is crypted (since maven 2.1.0) then decrypt it.
+ * <b>Note:</b> If the passphrase is crypted (since maven 2.1.0) then decrypt it.
*
* @parameter
* @since 1.1.0
@@ -91,7 +92,7 @@
/**
* The name of the property where to export the private key of the server.
* <p/>
- * <b>Note:</> If not set - then no export of the private key of the server.
+ * <b>Note:</b> If not set - then no export of the private key of the server.
*
* @parameter
* @since 1.1.0
@@ -111,7 +112,10 @@
* @since 1.1.0
*/
protected SecDispatcher sec;
- private boolean exportUsername, exportPassword, exportPassphrase, exportPrivateKey;
+ private boolean exportUsername;
+ private boolean exportPassword;
+ private boolean exportPassphrase;
+ private boolean exportPrivateKey;
@Override
protected boolean init() throws Exception {
Modified: trunk/src/site/apt/mojo-usages.apt
===================================================================
--- trunk/src/site/apt/mojo-usages.apt 2009-10-03 08:58:29 UTC (rev 602)
+++ trunk/src/site/apt/mojo-usages.apt 2009-10-09 07:21:10 UTC (rev 603)
@@ -27,10 +27,59 @@
projects in the reactor, and only keep all collected files in the root
project.
+------------------------------------------------------------------------------
+<plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>collect-files</id>
+ <goals>
+ <goal>collect-files</goal>
+ </goals>
+ <phase>install</phase>
+ <configuration>
+ <extraFiles>LICENSE.txt</extraFiles>
+ <descriptionFile>target/collects.txt</descriptionFile>
+ </configuration>
+ </execution>
+
+ </executions>
+</plugin>
+------------------------------------------------------------------------------
+
send-email
This goal sends an email with a content coming from a file.
+------------------------------------------------------------------------------
+<plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>send-email</goal>
+ </goals>
+ <phase>validate</phase>
+ </execution>
+ </executions>
+ <configuration>
+ <!-- for a multi-module just run on root project -->
+ <runOnce>true</runOnce>
+
+ <emailTitle>Title of email</emailTitle>
+ <emailContentFile>target/emailContent.txt</emailContentFile>
+ <mailSender>
+ <email>noreply(a)noway.fr</email>
+ </mailSender>
+ <toAddresses>
+ <item>receiver(a)noway.com</item>
+ </toAddresses>
+ <smtpHost>smtp</smtpHost>
+ </configuration>
+</plugin>
+------------------------------------------------------------------------------
share-server-secret
This goal shares servers informations (from your <settings.xml>)
@@ -52,8 +101,31 @@
* <<passwordOut>> (to share the password of the server)
- * <<passphraseOut>> (to share to passphrase of the server)
+ * <<privateKeyOut>> (to share the private key path of the server)
+ * <<passphraseOut>> (to share the passphrase of the server)
+
* After the execution of the mojo, the exported parameters will be available
for other mojo via (for example the <${username}> maven property).
+------------------------------------------------------------------------------
+<plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>share-server-secret</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <serverId>yourServerId</serverId>
+ <privateKeyOut>privateKey</privateKeyOut>
+ <passwordOut>password</passwordOut>
+ <usernameOut>username</usernameOut>
+ <passphraseOut>passphrase</passphraseOut>
+ </configuration>
+ </execution>
+ </executions>
+</plugin>
+------------------------------------------------------------------------------
1
0
03 Oct '09
Author: tchemit
Date: 2009-10-03 10:58:29 +0200 (Sat, 03 Oct 2009)
New Revision: 602
Added:
trunk/src/it/share-server-secret/
trunk/src/it/share-server-secret/multi/
trunk/src/it/share-server-secret/single/
trunk/src/it/share-server-secret/single/invoker.properties
trunk/src/it/share-server-secret/single/pom.xml
trunk/src/it/share-server-secret/single/verify.groovy
trunk/src/main/java/org/nuiton/helper/
trunk/src/main/java/org/nuiton/helper/plugin/
trunk/src/main/java/org/nuiton/helper/plugin/CheckProjectFilesPlugin.java
trunk/src/main/java/org/nuiton/helper/plugin/CollectFilesMojo.java
trunk/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java
trunk/src/site/apt/mojo-examples.apt
trunk/src/site/apt/mojo-framework.apt
trunk/src/site/apt/mojo-testFramework.apt
trunk/src/site/apt/mojo-usages.apt
Removed:
trunk/src/main/java/org/nuiton/io/plugin/
trunk/src/main/java/org/nuiton/plugin/CheckProjectFilesPlugin.java
trunk/src/main/java/org/nuiton/plugin/ShareServerSecretPlugin.java
trunk/src/site/apt/mojoFramework.apt
trunk/src/site/apt/mojoTestFramework.apt
Modified:
trunk/pom.xml
trunk/src/it/send-email/single/pom.xml
trunk/src/it/settings.xml
trunk/src/main/java/org/nuiton/mail/plugin/SendEmailMojo.java
trunk/src/main/java/org/nuiton/util/package.html
trunk/src/site/apt/index.apt
trunk/src/site/site.xml
Log:
finish goal share-server-secret + update docs + change packages
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-10-01 20:44:34 UTC (rev 601)
+++ trunk/pom.xml 2009-10-03 08:58:29 UTC (rev 602)
@@ -47,6 +47,12 @@
<version>1.2</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+
<!-- plexus -->
<dependency>
@@ -143,12 +149,6 @@
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- <version>1.6.2</version>
- </dependency>
-
<!-- forces use of javamail 1.4 since it's the only version available in the repo. We should remove this as soon
as the dependency in plexus-mail-sender-javamail will be updated
-->
@@ -259,14 +259,73 @@
</developers>
<!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+
+ <mailingLists>
+ <mailingList>
+ <name>maven-helper-plugin-commits</name>
+ <subscribe>http://list.nuiton.org/cgi-bin/mailman/listinfo/maven-helper-plugin-commits</subscribe>
+ <unsubscribe>http://list.nuiton.org/cgi-bin/mailman/listinfo/maven-helper-plugin-commits</unsubscribe>
+ <post>maven-helper-plugin-commits(a)list.nuiton.org</post>
+ <archive>http://list.nuiton.org/pipermail/maven-helper-plugin-commits/</archive>
+ </mailingList>
+
+ <mailingList>
+ <name>maven-helper-plugin-devel</name>
+ <subscribe>http://list.nuiton.org/cgi-bin/mailman/listinfo/maven-helper-plugin-devel</subscribe>
+ <unsubscribe>http://list.nuiton.org/cgi-bin/mailman/listinfo/maven-helper-plugin-devel</unsubscribe>
+ <post>maven-helper-plugin-devel(a)list.nuiton.org</post>
+ <archive>http://list.nuiton.org/pipermail/maven-helper-plugin-devel/</archive>
+ </mailingList>
+
+ <mailingList>
+ <name>maven-helper-plugin-users</name>
+ <subscribe>http://list.nuiton.org/cgi-bin/mailman/listinfo/maven-helper-plugin-users</subscribe>
+ <unsubscribe>http://list.nuiton.org/cgi-bin/mailman/listinfo/maven-helper-plugin-users</unsubscribe>
+ <post>maven-helper-plugin-users(a)list.nuiton.org</post>
+ <archive>http://list.nuiton.org/pipermail/maven-helper-plugin-users/</archive>
+ </mailingList>
+ </mailingLists>
+
+ <scm>
+ <connection>scm:svn:http://svn.nuiton.org/svn/maven-helper-plugin/trunk</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/maven-helper-plugin/trunk</developerConnection>
+ <url>http://www.nuiton.org/repositories/browse/maven-helper-plugin/trunk</url>
+ </scm>
+
+ <issueManagement>
+ <system>Redmine</system>
+ <url>http://www.nuiton.org/projects/maven-helper-plugin/issues/</url>
+ </issueManagement>
+
+ <distributionManagement>
+ <repository>
+ <id>nuiton</id>
+ <url>scpexe://nuiton.org/var/lib/maven/release</url>
+ </repository>
+ <snapshotRepository>
+ <id>nuiton</id>
+ <url>scpexe://nuiton.org/var/lib/maven/snapshot</url>
+ </snapshotRepository>
+ <site>
+ <id>nuiton</id>
+ <url>scpexe://nuiton.org/var/lib/redmine-nuiton/project-site/maven-helper-plugin</url>
+ </site>
+ </distributionManagement>
+
+ <ciManagement>
+ <system>hudson</system>
+ <url>http://hudson.nuiton.org/hudson/job/maven-helper-plugin</url>
+ </ciManagement>
+
+ <!-- ************************************************************* -->
<!-- *** Build Settings ****************************************** -->
<!-- ************************************************************* -->
<packaging>maven-plugin</packaging>
<properties>
-
- <listId>${project.artifactId}</listId>
<maven.version>2.2.1</maven.version>
<plexusMailSender.version>1.0-alpha-2</plexusMailSender.version>
@@ -884,69 +943,6 @@
</plugins>
</reporting>
- <!-- ************************************************************* -->
- <!-- *** Build Environment ************************************** -->
- <!-- ************************************************************* -->
-
- <!--Source control management-->
- <scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/maven-helper-plugin/trunk</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/maven-helper-plugin/trunk</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/maven-helper-plugin/trunk</url>
- </scm>
-
- <issueManagement>
- <system>Redmine</system>
- <url>http://www.nuiton.org/projects/${project.artifactId}/issues/</url>
- </issueManagement>
-
- <distributionManagement>
- <repository>
- <id>nuiton</id>
- <url>scpexe://nuiton.org/var/lib/maven/release</url>
- </repository>
- <snapshotRepository>
- <id>nuiton</id>
- <url>scpexe://nuiton.org/var/lib/maven/snapshot</url>
- </snapshotRepository>
- <site>
- <id>nuiton</id>
- <url>scpexe://nuiton.org/var/lib/redmine-nuiton/project-site/${project.artifactI…</url>
- </site>
- </distributionManagement>
-
- <ciManagement>
- <system>hudson</system>
- <url>http://hudson.nuiton.org/hudson/job/${project.artifactId}</url>
- </ciManagement>
-
- <!--Any mailing lists for the project-->
- <mailingLists>
- <mailingList>
- <name>${listId}-commits</name>
- <subscribe>http://list.nuiton.org/cgi-bin/mailman/listinfo/${listId}-commits</subscribe>
- <unsubscribe>http://list.nuiton.org/cgi-bin/mailman/listinfo/${listId}-commits</unsubscribe>
- <post>${listId}-commits(a)list.nuiton.org</post>
- <archive>http://list.nuiton.org/pipermail/${listId}-commits/</archive>
- </mailingList>
-
- <mailingList>
- <name>${listId}-devel</name>
- <subscribe>http://list.nuiton.org/cgi-bin/mailman/listinfo/${listId}-devel</subscribe>
- <unsubscribe>http://list.nuiton.org/cgi-bin/mailman/listinfo/${listId}-devel</unsubscribe>
- <post>${listId}-devel(a)list.nuiton.org</post>
- <archive>http://list.nuiton.org/pipermail/${listId}-devel/</archive>
- </mailingList>
-
- <mailingList>
- <name>${listId}-users</name>
- <subscribe>http://list.nuiton.org/cgi-bin/mailman/listinfo/${listId}-users</subscribe>
- <unsubscribe>http://list.nuiton.org/cgi-bin/mailman/listinfo/${listId}-users</unsubscribe>
- <post>${listId}-users(a)list.nuiton.org</post>
- <archive>http://list.nuiton.org/pipermail/${listId}-users/</archive>
- </mailingList>
- </mailingLists>
-
<profiles>
<!-- perform only on a release stage when using the maven-release-plugin -->
<profile>
@@ -1043,6 +1039,7 @@
<pomInclude>collect-files/single/pom.xml</pomInclude>
<pomInclude>collect-files/multi/pom.xml</pomInclude>
<pomInclude>send-email/single/pom.xml</pomInclude>
+ <pomInclude>share-server-secret/single/pom.xml</pomInclude>
</pomIncludes>
<postBuildHookScript>verify</postBuildHookScript>
<localRepositoryPath>${basedir}/target/local-repo</localRepositoryPath>
Modified: trunk/src/it/send-email/single/pom.xml
===================================================================
--- trunk/src/it/send-email/single/pom.xml 2009-10-01 20:44:34 UTC (rev 601)
+++ trunk/src/it/send-email/single/pom.xml 2009-10-03 08:58:29 UTC (rev 602)
@@ -32,11 +32,9 @@
<artifactId>maven-helper-plugin</artifactId>
<version>${pluginVersion}</version>
<configuration>
- <!-- Send nothing ! -->
+ <!-- Send nothing ! -->
<dryRun>true</dryRun>
- <!--<serverId>redmine-local</serverId>-->
-
<emailTitle>[TEST] - ${project.name} ${project.version} send-email</emailTitle>
<emailContentFile>emailContent.txt</emailContentFile>
<mailSender>
@@ -44,7 +42,7 @@
<email>noreply(a)noway.fr</email>
</mailSender>
<toAddresses>
- <item>chemit(a)codelutin.com</item>
+ <item>try(a)noway.fr</item>
</toAddresses>
<smtpHost>smtp</smtpHost>
</configuration>
@@ -52,37 +50,6 @@
</plugins>
</pluginManagement>
- <!--<plugins>
- <plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-helper-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>send-email</goal>
- </goals>
- <phase>validate</phase>
- </execution>
- </executions>
- <configuration>
- Send nothing !
- <dryRun>true</dryRun>
-
- <serverId>redmine-local</serverId>
-
- <emailTitle>[TEST] - ${project.name} ${project.version} send-email</emailTitle>
- <emailContentFile>emailContent.txt</emailContentFile>
- <mailSender>
- <name>Nuiton Release Notification</name>
- <email>noreply(a)noway.fr</email>
- </mailSender>
- <toAddresses>
- <item>chemit(a)codelutin.com</item>
- </toAddresses>
- <smtpHost>smtp</smtpHost>
- </configuration>
- </plugin>
- </plugins>-->
</build>
</project>
Modified: trunk/src/it/settings.xml
===================================================================
--- trunk/src/it/settings.xml 2009-10-01 20:44:34 UTC (rev 601)
+++ trunk/src/it/settings.xml 2009-10-03 08:58:29 UTC (rev 602)
@@ -22,11 +22,23 @@
<settings>
<servers>
+
<server>
- <id>redmine-local</id>
- <username>chemit</username>
- <password>{i4S9W9sEp0gH4jrveLOLJlL0O0D5TpyIplB4Abql5o8=}</password>
+ <id>serverOne</id>
+ <username>serverOne-username</username>
+ <password>serverOne-password</password>
+ <passphrase>serverOne-passphrase</passphrase>
+ <privateKey>serverOne-privateKey</privateKey>
</server>
+
+ <server>
+ <id>serverTwo</id>
+ <username>serverTwo-username</username>
+ <password>serverTwo-password</password>
+ <passphrase>serverTwo-passphrase</passphrase>
+ <privateKey>serverTwo-privateKey</privateKey>
+ </server>
+
</servers>
<profiles>
@@ -45,7 +57,7 @@
<snapshots>
<enabled>true</enabled>
</snapshots>
- </repository>
+ </repository>
</repositories>
<pluginRepositories>
<pluginRepository>
Added: trunk/src/it/share-server-secret/single/invoker.properties
===================================================================
--- trunk/src/it/share-server-secret/single/invoker.properties (rev 0)
+++ trunk/src/it/share-server-secret/single/invoker.properties 2009-10-03 08:58:29 UTC (rev 602)
@@ -0,0 +1,21 @@
+# A comma or space separated list of goals/phases to execute, may
+# specify an empty list to execute the default goal of the IT project
+invoker.goals=clean initialize
+
+# Optionally, a list of goals to run during further invocations of Maven
+#invoker.goals.2=${project.groupId}:${project.artifactId}:${project.version}:run
+
+# A comma or space separated list of profiles to activate
+#invoker.profiles=its,jdk15
+
+# The value for the environment variable MAVEN_OPTS
+#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
+
+# The expected result of the build, possible values are "success" (default) and "failure"
+#invoker.buildResult=success
+
+# A boolean value controlling the -N flag, defaults to "false"
+#invoker.nonRecursive=false
Added: trunk/src/it/share-server-secret/single/pom.xml
===================================================================
--- trunk/src/it/share-server-secret/single/pom.xml (rev 0)
+++ trunk/src/it/share-server-secret/single/pom.xml 2009-10-03 08:58:29 UTC (rev 602)
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.nuiton.test</groupId>
+ <artifactId>single</artifactId>
+ <version>0</version>
+
+ <name>Maven-helper-plugin single</name>
+ <packaging>pom</packaging>
+ <description>Maven helper plugin for a single module.</description>
+
+ <url>http://www.foo.com</url>
+
+ <properties>
+
+ <pluginVersion>@pom.version@</pluginVersion>
+
+ <!-- default encoding -->
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+ </properties>
+
+ <build>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <version>${pluginVersion}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-helper-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>get-server-one</id>
+ <goals>
+ <goal>share-server-secret</goal>
+ </goals>
+ <configuration>
+ <serverId>serverOne</serverId>
+ <usernameOut>username</usernameOut>
+ <passwordOut>password</passwordOut>
+ <passphraseOut>passphrase</passphraseOut>
+ <privateKeyOut>privateKey</privateKeyOut>
+ </configuration>
+ </execution>
+ <execution>
+ <id>get-server-two</id>
+ <goals>
+ <goal>share-server-secret</goal>
+ </goals>
+ <configuration>
+ <serverId>serverTwo</serverId>
+ <usernameOut>username2</usernameOut>
+ <passwordOut>password2</passwordOut>
+ <passphraseOut>passphrase2</passphraseOut>
+ <privateKeyOut>privateKey2</privateKeyOut>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>initialize</phase>
+ <configuration>
+ <tasks>
+ <echo message="username = ${username}"/>
+ <echo message="password = ${password}"/>
+ <echo message="passphrase = ${passphrase}"/>
+ <echo message="privateKey = ${privateKey}"/>
+ <echo message="username2 = ${username2}"/>
+ <echo message="password2 = ${password2}"/>
+ <echo message="passphrase2 = ${passphrase2}"/>
+ <echo message="privateKey2 = ${privateKey2}"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ </plugins>
+ </build>
+
+</project>
Added: trunk/src/it/share-server-secret/single/verify.groovy
===================================================================
--- trunk/src/it/share-server-secret/single/verify.groovy (rev 0)
+++ trunk/src/it/share-server-secret/single/verify.groovy 2009-10-03 08:58:29 UTC (rev 602)
@@ -0,0 +1,14 @@
+assert new File(basedir, 'build.log').exists();
+
+content = new File(basedir, 'build.log').text;
+
+assert content.contains( 'username = serverOne-username' );
+assert content.contains( 'password = serverOne-password' );
+assert content.contains( 'passphrase = serverOne-passphrase' );
+assert content.contains( 'privateKey = serverOne-privateKey' );
+assert content.contains( 'username2 = serverTwo-username' );
+assert content.contains( 'password2 = serverTwo-password' );
+assert content.contains( 'passphrase2 = serverTwo-passphrase' );
+assert content.contains( 'privateKey2 = serverTwo-privateKey' );
+
+return true;
Copied: trunk/src/main/java/org/nuiton/helper/plugin/CheckProjectFilesPlugin.java (from rev 601, trunk/src/main/java/org/nuiton/plugin/CheckProjectFilesPlugin.java)
===================================================================
--- trunk/src/main/java/org/nuiton/helper/plugin/CheckProjectFilesPlugin.java (rev 0)
+++ trunk/src/main/java/org/nuiton/helper/plugin/CheckProjectFilesPlugin.java 2009-10-03 08:58:29 UTC (rev 602)
@@ -0,0 +1,129 @@
+/*
+ * *##%
+ * 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.helper.plugin;
+
+import org.nuiton.plugin.*;
+import java.io.File;
+import org.apache.maven.plugin.MojoExecutionException;
+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
+ * @deprecated since 1.1.0, reuse just a enforcer plugin to check those files.
+ */
+@Deprecated
+public class CheckProjectFilesPlugin extends AbstractPlugin {
+
+ /**
+ * 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 MavenProject getProject() {
+ return project;
+ }
+
+ @Override
+ public void setProject(MavenProject project) {
+ this.project = project;
+ }
+
+ @Override
+ public boolean isVerbose() {
+ return verbose;
+ }
+
+ @Override
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ @Override
+ protected boolean init() throws Exception {
+ return true;
+ }
+
+ @Override
+ protected void doAction() throws Exception {
+ 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());
+ }
+ }
+ }
+}
Copied: trunk/src/main/java/org/nuiton/helper/plugin/CollectFilesMojo.java (from rev 599, trunk/src/main/java/org/nuiton/io/plugin/CollectFilesMojo.java)
===================================================================
--- trunk/src/main/java/org/nuiton/helper/plugin/CollectFilesMojo.java (rev 0)
+++ trunk/src/main/java/org/nuiton/helper/plugin/CollectFilesMojo.java 2009-10-03 08:58:29 UTC (rev 602)
@@ -0,0 +1,421 @@
+/*
+ * *##%
+ * 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.helper.plugin;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.nuiton.plugin.AbstractPlugin;
+
+/**
+ * Collect files some files from a project and copy them into a directory.
+ *
+ * @goal collect-files
+ * @requiresProject true
+ *
+ * @author tchemit
+ * @since 1.1.0
+ */
+public class CollectFilesMojo extends AbstractPlugin {
+
+ /**
+ * Dependance du projet.
+ *
+ * @parameter default-value="${project}"
+ * @required
+ * @readonly
+ * @since 1.0.3
+ */
+ protected MavenProject project;
+ /**
+ * The artifacts to publish from the project build.
+ *
+ * @parameter expression="${project.attachedArtifacts}"
+ * @required
+ * @readonly
+ * @since 1.0.0
+ */
+ protected List attachedArtifacts;
+ /**
+ * User extra files to collect.
+ *
+ * Multi values can be used, separated by comma.
+ *
+ * @parameter expression="${helper.extraFiles}"
+ * @since 1.0.0
+ */
+ protected String extraFiles;
+ /**
+ * File name pattern of selected files to publish.
+ *
+ * If no Set - no include filter
+ *
+ * @parameter expression="${helper.includes}" default-value=""
+ * @since 1.0.0
+ */
+ protected String includes;
+ /**
+ * File name pattern of selected files to publish.
+ *
+ * If no Set - no exclude filter
+ *
+ * @parameter expression="${helper.excludes}" default-value=""
+ * @since 1.0.0
+ */
+ protected String excludes;
+ /**
+ * Directory where to store collected files.
+ * <p/>
+ * <b>Note :</b> In a multi-module context, will always use the value of
+ * the property of the root module, because we need to push collected files
+ * to only one place.
+ *
+ * @parameter expression="${helper.outputDirectory}" default-value="target/collect"
+ * @since 1.0.0
+ */
+ protected String outputDirectory;
+ /**
+ * File with all files collected (one file by line in absolute path).
+ * <p/>
+ * <b>Note :</b> If not Set, will not generate the description file.
+ *
+ * @parameter expression="${helper.descriptionFile}"
+ * @since 1.0.0
+ */
+ protected String descriptionFile;
+ /**
+ * Un flag pour collecter aussi les fichiers attaches au projet.
+ *
+ * @parameter expression="${helper.includeAttached}" default-value="true"
+ * @since 1.0.0
+ */
+ protected boolean includeAttached;
+ /**
+ * Un flag pour recopier les fichiers collectés.
+ *
+ * @parameter expression="${helper.copyFiles}" default-value="true"
+ * @since 1.0.0
+ */
+ protected boolean copyFiles;
+ /**
+ * Un flag pour activer le mode verbeux.
+ *
+ * @parameter expression="${helper.verbose}" default-value="${maven.verbose}"
+ * @since 1.0.0
+ */
+ protected boolean verbose;
+ /**
+ * A flag to skip the goal.
+ *
+ * @parameter expression="${helper.skip}" default-value="false"
+ * @since 1.0.0
+ */
+ protected boolean skip;
+ /**
+ * Un flag pour activer le mode verbeux.
+ *
+ * @parameter expression="${helper.dryRun}" default-value="false"
+ * @since 1.0.0
+ */
+ protected boolean dryRun;
+ /**
+ * Encoding a utiliser pour lire et ecrire les fichiers.
+ *
+ * @parameter expression="${helper.encoding}" default-value="${project.build.sourceEncoding}"
+ * @required
+ * @since 1.0.0
+ */
+ protected String encoding;
+ List<File> files;
+
+ @Override
+ protected boolean init() throws Exception {
+ if (skip) {
+ return true;
+ }
+
+ files = getFiles();
+ if (files.isEmpty()) {
+
+ getLog().warn("No file to collect.");
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public void doAction() throws Exception {
+
+ if (skip) {
+ getLog().info("Skip flag in on, goal will not be executed");
+ return;
+ }
+
+ MavenProject rootProject = getExecutionRootProject();
+
+ File base = new File(rootProject.getBasedir(), outputDirectory);
+
+ File output = new File(base, project.getGroupId() + "--" + project.getArtifactId());
+
+ if (rootProject == project || verbose) {
+ // just print on root
+ getLog().info("Ouput dir : " + output);
+ }
+
+ if (dryRun) {
+ getLog().info("\n dryRun flag is on, no file will be copied!\n");
+ } else {
+
+ if (copyFiles && !output.exists()) {
+ output.mkdirs();
+ }
+ }
+
+ File description = null;
+
+ List<File> incomingFiles = null;
+
+ boolean withDescriptionFile = false;
+
+ if (descriptionFile != null && !descriptionFile.trim().isEmpty()) {
+
+ description = new File(rootProject.getBasedir(), descriptionFile);
+
+ withDescriptionFile = true;
+
+ if (description.exists()) {
+ // reload existing
+ try {
+ incomingFiles = getFiles(description);
+ getLog().info("Loaded " + description);
+ } catch (IOException ex) {
+ throw new MojoExecutionException("could not load file " + description, ex);
+ }
+ } else {
+ incomingFiles = new ArrayList<File>();
+ }
+ }
+
+ if (!withDescriptionFile && !copyFiles) {
+ throw new MojoExecutionException("must use at least one of the parameters 'copyFiles' or 'descriptionFile'");
+ }
+
+ String basedir = rootProject.getBasedir().getAbsolutePath();
+ int basedirLength = basedir.length();
+ for (File f : files) {
+ String absolutePath = f.getAbsolutePath();
+ String path = absolutePath.substring(basedirLength + 1);
+ File dst = new File(output, f.getName());
+
+ if (withDescriptionFile) {
+ if (copyFiles) {
+ incomingFiles.add(dst);
+ } else {
+ incomingFiles.add(f);
+ }
+ }
+
+ getLog().info("collected file " + path);
+ if (!dryRun && copyFiles) {
+ // copy the collected file
+ copyFile(f, dst);
+
+ }
+ }
+
+ if (!dryRun && withDescriptionFile) {
+ try {
+ setFiles(description, incomingFiles);
+ getLog().info("Saved " + description);
+ } catch (IOException ex) {
+ throw new MojoExecutionException("could not save file " + description, ex);
+ }
+ }
+ }
+
+ /**
+ * Read a file containing on each line the path of a file.
+ *
+ * @param input the file containing the list of files
+ * @return the list of files read from the given file
+ * @throws IOException if any pb while reading file
+ */
+ public List<File> getFiles(File input) throws IOException {
+ List<File> result = new ArrayList<File>();
+ BufferedReader stream = new BufferedReader(new InputStreamReader(new FileInputStream(input)));
+ while (stream.ready()) {
+ String line = stream.readLine().trim();
+ if (!line.isEmpty()) {
+ File f = new File(line);
+ result.add(f);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Save the list of files in the given output file.
+ * <p/>
+ * Each line is the absolute path of each files of the list
+ *
+ * @param output the file when to write
+ * @param files the files to store
+ * @throws IOException if any pb when writing file
+ */
+ public void setFiles(File output, List<File> files) throws IOException {
+// BufferedWriter writer = new BufferedWriter(new FileWriter(output));
+ StringBuilder builder = new StringBuilder();
+ for (File f : files) {
+ builder.append(f.getAbsolutePath()).append("\n");
+// writer.write(f.getAbsolutePath());
+// writer.newLine();
+ }
+ writeFile(output, builder.toString(), encoding);
+// writer.close();
+ }
+
+ protected List<File> getFiles() {
+
+ Pattern includePattern = includes == null || includes.trim().isEmpty() ? null : Pattern.compile(includes.trim());
+ Pattern excludePattern = excludes == null || excludes.trim().isEmpty() ? null : Pattern.compile(excludes.trim());
+
+ List<File> result = new ArrayList<File>();
+
+ // attach the project mail file
+
+ if (includeAttached) {
+
+ if ("pom".equals(project.getPackaging())) {
+ addFile(project.getFile(), "adding artifact file : ", result, includePattern, excludePattern);
+ } else {
+ Artifact a = project.getArtifact();
+ if (a != null) {
+ addFile(a.getFile(), "adding artifact file : ", result, includePattern, excludePattern);
+ }
+ }
+ }
+ File file;
+
+ // attach extra files
+
+ if (extraFiles != null && !extraFiles.trim().isEmpty()) {
+
+ File basedir = project.getBasedir();
+ for (String path : extraFiles.split(",")) {
+ path = path.trim();
+ if (path.startsWith(basedir.getAbsolutePath())) {
+ file = new File(path.trim());
+ } else {
+ file = new File(basedir, path.trim());
+ }
+
+ addFile(file, "adding user file : ", result, includePattern, excludePattern);
+
+ }
+ }
+
+ // attach project attached files
+
+ if (includeAttached && attachedArtifacts != null) {
+
+ for (Object o : attachedArtifacts) {
+
+ file = ((Artifact) o).getFile();
+ addFile(file, "adding attached artifact file : ", result, includePattern, excludePattern);
+ }
+ }
+
+ return result;
+ }
+
+ protected MavenProject getExecutionRootProject() {
+ MavenProject root = project;
+ while (!root.isExecutionRoot()) {
+ root = root.getParent();
+ }
+ if (verbose) {
+ getLog().info("root project " + root);
+ }
+ return root;
+ }
+
+ protected void addFile(File f, String msg, List<File> files, Pattern includePattern, Pattern excludePattern) {
+ if (f == null) {
+ return;
+ }
+ if (!f.exists()) {
+ getLog().warn("skip unexisting file " + f + " (" + msg + ")");
+ return;
+ }
+ if (excludePattern != null) {
+ if (excludePattern.matcher(f.getName()).matches()) {
+ // skip this file
+ if (verbose) {
+ getLog().info("skip " + f + " : in excludes " + excludes);
+ }
+ return;
+ }
+ }
+ if (includePattern != null) {
+ if (!includePattern.matcher(f.getName()).matches()) {
+ // skip this file
+ if (verbose) {
+ getLog().info("skip " + f + " : not in includes " + includes);
+ }
+ return;
+ }
+ }
+ if (verbose) {
+ getLog().info(msg + f);
+ }
+ files.add(f);
+ }
+
+ @Override
+ public MavenProject getProject() {
+ return project;
+ }
+
+ @Override
+ public boolean isVerbose() {
+ return verbose;
+ }
+
+ @Override
+ public void setProject(MavenProject project) {
+ this.project = project;
+ }
+
+ @Override
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+}
+
Copied: trunk/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java (from rev 601, trunk/src/main/java/org/nuiton/plugin/ShareServerSecretPlugin.java)
===================================================================
--- trunk/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java (rev 0)
+++ trunk/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java 2009-10-03 08:58:29 UTC (rev 602)
@@ -0,0 +1,202 @@
+package org.nuiton.helper.plugin;
+
+import org.nuiton.plugin.*;
+import java.util.Properties;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Server;
+import org.apache.maven.settings.Settings;
+import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
+
+/**
+ * Obtain a server authentication and share it in the maven
+ * project properties.
+ * <p/>
+ * To select data to export from the server with the given {@code serverId},
+ * fill the properties :
+ * <pre>
+ * usernameOut
+ * passwordOut
+ * passphraseOut
+ * </pre>
+ *
+ * @author chemit
+ * @since 1.1.0
+ *
+ * @goal share-server-secret
+ * @phase initialize
+ * @requiresProject true
+ */
+public class ShareServerSecretPlugin extends AbstractPlugin {
+
+ /**
+ * Dependance du projet.
+ *
+ * @parameter default-value="${project}"
+ * @required
+ * @readonly
+ * @since 1.1.0
+ */
+ protected MavenProject project;
+ /**
+ * Dependance du settings.
+ *
+ * @parameter default-value="${settings}"
+ * @required
+ * @readonly
+ * @since 1.1.0
+ */
+ protected Settings settings;
+ /**
+ * Server id to use for authentication (must be defined in your setting
+ * and use the maven >= 2.1.0 password encryption mecanism).
+ * <p/>
+ *
+ * @parameter expression="${helper.serverId}"
+ * @required
+ * @since 1.1.0
+ */
+ protected String serverId;
+ /**
+ * The name of the property where to export the username of the server.
+ * <p/>
+ * <b>Note:</> If not set - then no export of the username of the server.
+ *
+ * @parameter
+ * @since 1.1.0
+ */
+ private String usernameOut;
+ /**
+ * The name of the property where to export the password of the server.
+ * <p/>
+ * <b>Note:</> If not set - then no export of the password of the server.
+ * <p/>
+ * <b>Note:</> If the password is crypted (since maven 2.1.0) then decrypt it.
+ *
+ * @parameter
+ * @since 1.1.0
+ */
+ private String passwordOut;
+ /**
+ * The name of the property where to export the passphrase of the server.
+ * <p/>
+ * <b>Note:</> If not set - then no export of the passphrase of the server.
+ * <p/>
+ * <b>Note:</> If the passphrase is crypted (since maven 2.1.0) then decrypt it.
+ *
+ * @parameter
+ * @since 1.1.0
+ */
+ private String passphraseOut;
+ /**
+ * The name of the property where to export the private key of the server.
+ * <p/>
+ * <b>Note:</> If not set - then no export of the private key of the server.
+ *
+ * @parameter
+ * @since 1.1.0
+ */
+ private String privateKeyOut;
+ /**
+ * Un flag pour activer le mode verbeux.
+ *
+ * @parameter expression="${helper.verbose}" default-value="${maven.verbose}"
+ * @since 1.1.0
+ */
+ protected boolean verbose;
+ /**
+ * password decypher
+ *
+ * @component roleHint="maven-helper-plugin"
+ * @since 1.1.0
+ */
+ protected SecDispatcher sec;
+ private boolean exportUsername, exportPassword, exportPassphrase, exportPrivateKey;
+
+ @Override
+ protected boolean init() throws Exception {
+ if (usernameOut != null && !usernameOut.trim().isEmpty()) {
+ exportUsername = true;
+ }
+ if (passwordOut != null && !passwordOut.trim().isEmpty()) {
+ exportPassword = true;
+ }
+ if (passphraseOut != null && !passphraseOut.trim().isEmpty()) {
+ exportPassphrase = true;
+ }
+ if (privateKeyOut != null && !privateKeyOut.trim().isEmpty()) {
+ exportPrivateKey = true;
+ }
+ if (!(exportUsername || exportPassword || exportPassphrase || exportPrivateKey)) {
+ getLog().error("Nothing to export, you should specify what to export via 'usernameOut', 'passwordOut', 'passphraseOut', 'privateKeyOut' parameters.");
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected void doAction() throws Exception {
+ Server server = null;
+
+ if (serverId != null && !serverId.trim().isEmpty()) {
+
+ server = settings.getServer(serverId);
+
+ if (server == null) {
+ throw new MojoExecutionException("Could not find server with id '" + serverId + "', check your settings.xml file.");
+ }
+ }
+
+ Properties properties = project.getModel().getProperties();
+
+ if (exportUsername) {
+
+ String username = server.getUsername();
+ username = sec.decrypt(username);
+ getLog().info("export server [" + serverId + "] username in ${" + usernameOut + "}");
+ properties.setProperty(usernameOut, username);
+ }
+
+ if (exportPassword) {
+ String password = server.getPassword();
+ password = sec.decrypt(password);
+
+ getLog().info("export server [" + serverId + "] password in ${" + passwordOut + "}");
+ properties.setProperty(passwordOut, password);
+ }
+
+ if (exportPassphrase) {
+ String passphrase = server.getPassphrase();
+ passphrase = sec.decrypt(passphrase);
+
+ getLog().info("export server [" + serverId + "] passphrase in ${" + passphraseOut + "}");
+ properties.setProperty(passphraseOut, passphrase);
+ }
+ if (exportPrivateKey) {
+ String privateKey = server.getPrivateKey();
+
+ getLog().info("export server [" + serverId + "] privateKey in ${" + privateKeyOut + "}");
+ properties.setProperty(privateKeyOut, privateKey);
+ }
+ }
+
+ @Override
+ public MavenProject getProject() {
+ return project;
+ }
+
+ @Override
+ public void setProject(MavenProject project) {
+ this.project = project;
+ }
+
+ @Override
+ public boolean isVerbose() {
+ return verbose;
+ }
+
+ @Override
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+}
Property changes on: trunk/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: svn:mergeinfo
+
Modified: trunk/src/main/java/org/nuiton/mail/plugin/SendEmailMojo.java
===================================================================
--- trunk/src/main/java/org/nuiton/mail/plugin/SendEmailMojo.java 2009-10-01 20:44:34 UTC (rev 601)
+++ trunk/src/main/java/org/nuiton/mail/plugin/SendEmailMojo.java 2009-10-03 08:58:29 UTC (rev 602)
@@ -20,8 +20,7 @@
*/
package org.nuiton.mail.plugin;
-import org.nuiton.mail.*;
-import org.nuiton.plugin.*;
+import org.nuiton.plugin.AbstractPlugin;
import org.nuiton.plugin.PluginHelper;
import java.io.File;
@@ -30,13 +29,13 @@
import org.apache.maven.model.Developer;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
-import org.apache.maven.settings.Server;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.logging.console.ConsoleLogger;
import org.codehaus.plexus.mailsender.MailMessage;
import org.codehaus.plexus.mailsender.MailSenderException;
-import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
+import org.nuiton.mail.MailSender;
+import org.nuiton.mail.ProjectJavamailMailSender;
/**
* Send a email.
@@ -122,15 +121,6 @@
*/
private String password;
/**
- * Server id to use for authentication (must be defined in your setting
- * and use the maven >= 2.1.0 password encryption mecanism).
- * <p/>
- *
- * @parameter expression="${helper.serverId}"
- * @since 1.0.3
- */
- protected String serverId;
- /**
* If the email should be sent in SSL mode.
*
* @parameter default-value="false" expression="${helper.sslMode}"
@@ -208,13 +198,6 @@
*/
private boolean runOnce;
/**
- * password decypher
- *
- * @component roleHint="maven-helper-plugin"
- * @since 1.0.3
- */
- protected SecDispatcher sec;
- /**
* internal flag to know if plugin was already executed (for multi-module projects)
*/
private boolean runOnceDone;
@@ -241,11 +224,10 @@
public void setVerbose(boolean verbose) {
this.verbose = verbose;
}
-
+
///////////////////////////////////////////////////////////////////////////
/// AbstractPlugin
///////////////////////////////////////////////////////////////////////////
-
@Override
protected boolean init() throws Exception {
@@ -271,47 +253,6 @@
return false;
}
- // check server (if used)
-
- Server server = null;
-
- if (serverId != null && !serverId.trim().isEmpty()) {
-
- server = settings.getServer(serverId);
-
- if (server == null) {
- getLog().error("Could not find server with id '" + serverId + "', check your settings.xml file.");
- return false;
- }
- }
-
- // check authentication configuration is stable
-
- boolean noUsername = username == null || username.trim().isEmpty();
- boolean noPassword = password == null || password.trim().isEmpty();
-
- if (server != null && !noUsername) {
- getLog().error("Authentication configuration is wrong :\ncan not use both 'serverId' and 'username' parameters, check your plugin configuration.");
- return false;
- }
-
- if (server != null && !noPassword) {
- getLog().error("Authentication configuration is wrong :\ncan not use both 'serverId' and 'password' parameters, check your plugin configuration.");
- return false;
- }
-
- if ((noUsername && !noPassword) || (!noUsername && noPassword)) {
- getLog().error("Authentication configuration is wrong :\nconfiguration is not complete, please fill parameter 'serverId' or 'username' and 'password'.");
- return false;
- }
-
- if (server != null) {
- // obtain username and password from server
-
- username = server.getUsername();
- password = sec.decrypt(server.getPassword());
- }
-
// check mail sender
if (mailSender == null) {
@@ -353,6 +294,7 @@
@Override
protected void doAction() throws Exception {
if (runOnce && runOnceDone) {
+ // already run
return;
}
if (isGoalSkip()) {
@@ -397,7 +339,7 @@
protected boolean isGoalSkip() {
return skipSendEmail;
}
-
+
protected MailMessage createMessage(String newsContent, MailSender mailSender) throws MailSenderException {
String fromName = mailSender.getName();
Deleted: trunk/src/main/java/org/nuiton/plugin/CheckProjectFilesPlugin.java
===================================================================
--- trunk/src/main/java/org/nuiton/plugin/CheckProjectFilesPlugin.java 2009-10-01 20:44:34 UTC (rev 601)
+++ trunk/src/main/java/org/nuiton/plugin/CheckProjectFilesPlugin.java 2009-10-03 08:58:29 UTC (rev 602)
@@ -1,125 +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.plugin;
-
-import java.io.File;
-import org.apache.maven.plugin.MojoExecutionException;
-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 AbstractPlugin {
-
- /**
- * 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 MavenProject getProject() {
- return project;
- }
-
- @Override
- public void setProject(MavenProject project) {
- this.project = project;
- }
-
- @Override
- public boolean isVerbose() {
- return verbose;
- }
-
- @Override
- public void setVerbose(boolean verbose) {
- this.verbose = verbose;
- }
-
- @Override
- protected boolean init() throws Exception {
- return true;
- }
-
- protected void doAction() throws Exception {
- 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());
- }
- }
- }
-}
Deleted: trunk/src/main/java/org/nuiton/plugin/ShareServerSecretPlugin.java
===================================================================
--- trunk/src/main/java/org/nuiton/plugin/ShareServerSecretPlugin.java 2009-10-01 20:44:34 UTC (rev 601)
+++ trunk/src/main/java/org/nuiton/plugin/ShareServerSecretPlugin.java 2009-10-03 08:58:29 UTC (rev 602)
@@ -1,182 +0,0 @@
-package org.nuiton.plugin;
-
-import java.util.Properties;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.settings.Server;
-import org.apache.maven.settings.Settings;
-import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
-
-/**
- * Obtain a server authentication and share it in the maven
- * project properties.
- * <p/>
- * To select data to export from the server with the given {@code serverId},
- * fill the properties :
- * <pre>
- * usernameOut
- * passwordOut
- * passphraseOut
- * </pre>
- *
- * @author chemit
- * @since 1.1.0
- *
- * @goal share-server-secret
- * @phase initialize
- * @requireProjects true
- */
-public class ShareServerSecretPlugin extends AbstractPlugin {
-
- /**
- * Dependance du projet.
- *
- * @parameter default-value="${project}"
- * @required
- * @readonly
- * @since 1.1.0
- */
- protected MavenProject project;
- /**
- * Dependance du settings.
- *
- * @parameter default-value="${settings}"
- * @required
- * @readonly
- * @since 1.1.0
- */
- protected Settings settings;
- /**
- * Server id to use for authentication (must be defined in your setting
- * and use the maven >= 2.1.0 password encryption mecanism).
- * <p/>
- *
- * @parameter expression="${helper.serverId}"
- * @required
- * @since 1.1.0
- */
- protected String serverId;
- /**
- * The name of the property where to export the username of the server.
- * <p/>
- * <b>Note:</> If not set - then no export of the username of the server.
- *
- * @parameter
- * @since 1.1.0
- */
- private String usernameOut;
- /**
- * The name of the property where to export the password of the server.
- * <p/>
- * <b>Note:</> If not set - then no export of the password of the server.
- * <p/>
- * <b>Note:</> If the password is crypted (since maven 2.1.0) then decrypt it.
- *
- * @parameter
- * @since 1.1.0
- */
- private String passwordOut;
- /**
- * The name of the property where to export the passphrase of the server.
- * <p/>
- * <b>Note:</> If not set - then no export of the passphrase of the server.
- * <p/>
- * <b>Note:</> If the passphrase is crypted (since maven 2.1.0) then decrypt it.
- *
- * @parameter
- * @since 1.1.0
- */
- private String passphraseOut;
- /**
- * Un flag pour activer le mode verbeux.
- *
- * @parameter expression="${helper.verbose}" default-value="${maven.verbose}"
- * @since 1.1.0
- */
- protected boolean verbose;
- /**
- * password decypher
- *
- * @component roleHint="maven-helper-plugin"
- * @since 1.1.0
- */
- protected SecDispatcher sec;
- private boolean exportUsername, exportPassword, exportPassphrase;
-
- @Override
- protected boolean init() throws Exception {
- if (usernameOut != null && !usernameOut.trim().isEmpty()) {
- exportUsername = true;
- }
- if (passwordOut != null && !passwordOut.trim().isEmpty()) {
- exportPassword = true;
- }
- if (passphraseOut != null && !passphraseOut.trim().isEmpty()) {
- exportPassphrase = true;
- }
- if (!(exportUsername || exportPassword || exportPassphrase)) {
- getLog().error("Nothing to export, you should specify what to export via 'usernameOut', 'passwordOut', 'passphraseOut' parameters.");
- return false;
- }
- return true;
- }
-
- @Override
- protected void doAction() throws Exception {
- Server server = null;
-
- if (serverId != null && !serverId.trim().isEmpty()) {
-
- server = settings.getServer(serverId);
-
- if (server == null) {
- throw new MojoExecutionException("Could not find server with id '" + serverId + "', check your settings.xml file.");
- }
- }
-
- Properties properties = project.getModel().getProperties();
-
- if (exportUsername) {
-
- String username = server.getUsername();
- getLog().info("export server [" + serverId + "] username in ${" + usernameOut + "}");
- properties.setProperty(usernameOut, username);
- }
-
- if (exportPassword) {
- String password = server.getPassword();
- password = sec.decrypt(server.getPassword());
-
- getLog().info("export server [" + serverId + "] password in ${" + passwordOut + "}");
- properties.setProperty(passwordOut, password);
- }
-
- if (exportPassphrase) {
- String passphrase = server.getPassphrase();
- passphrase = sec.decrypt(server.getPassword());
-
- getLog().info("export server [" + serverId + "] passphrase in ${" + passphraseOut + "}");
- properties.setProperty(passphraseOut, passphrase);
- }
- }
-
- @Override
- public MavenProject getProject() {
- return project;
- }
-
- @Override
- public void setProject(MavenProject project) {
- this.project = project;
- }
-
- @Override
- public boolean isVerbose() {
- return verbose;
- }
-
- @Override
- public void setVerbose(boolean verbose) {
- this.verbose = verbose;
- }
-}
Modified: trunk/src/main/java/org/nuiton/util/package.html
===================================================================
--- trunk/src/main/java/org/nuiton/util/package.html 2009-10-01 20:44:34 UTC (rev 601)
+++ trunk/src/main/java/org/nuiton/util/package.html 2009-10-03 08:58:29 UTC (rev 602)
@@ -1,7 +1,5 @@
<html>
<body>
-<h1>Lutin plugin util</h1>
-Ensemble de classe Java permettant de simplifier le developpement de plugins maven en
-factorisant des besoins que l'on retrouve dans tous les developpements.
+<h1>Deprecated, will be remove before version 2.0.0</h1>
</body>
</html>
\ No newline at end of file
Modified: trunk/src/site/apt/index.apt
===================================================================
--- trunk/src/site/apt/index.apt 2009-10-01 20:44:34 UTC (rev 601)
+++ trunk/src/site/apt/index.apt 2009-10-03 08:58:29 UTC (rev 602)
@@ -5,11 +5,9 @@
2009-08-22
----
- <<TODO>> Update this documentation
-
Maven helper Plugin
- This project helps to build project on the {{{http://www.nuiton.org} nuiton}} platform.
+ This project helps to build maven projects.
There is three ways of using this toolbox :
@@ -23,27 +21,33 @@
The plugin has the following goals:
- * {{{add-license-mojo.html} helper:add-license}} add license file and third-party files to classpath (generate them if necessary).
+ * {{{share-server-secret-mojo.html} helper:share-server-secret}} to expose a server secret data in project.
- * {{{add-third-party-mojo.html} helper:add-third-party}} write the licenses of all third-party libraries used in project.
+ * {{{send-email-mojo.html} helper:send-email}} to send a email.
+ * {{{collect-files-mojo.html} helper:collect-files}} to collect some files over a project.
+
* {{{help-mojo.html} helper:help}} display help about the plugin (goals, usage).
- * {{{available-licenses-mojo.html} helper:available-licenses}} display the known licenses of the plugin.
+ * {{{add-license-mojo.html} helper:add-license}} *DEPRECATED* add license file and third-party files to classpath (generate them if necessary).
- * {{{collect-files-mojo.html} helper:collect-files}} to collect some files over a project.
+ * {{{add-third-party-mojo.html} helper:add-third-party}} *DEPRECATED* write the licenses of all third-party libraries used in project.
- * {{{send-email-mojo.html} helper:send-email}} to sned a email.
+ * {{{available-licenses-mojo.html} helper:available-licenses}} *DEPRECATED* display the known licenses of the plugin.
+ Consult the {{{mojo-usages.html}usages}} page to have more details of mojos.
+
+ Consult the {{{mojo-examples.html}examples}} page to have some examples of mojos.
+
Plugin toolkit overview
- {{{mojoFramework.html}Mojo framework}}.
+ see the {{{mojo-framework.html}Mojo framework}} page.
see {{{apidocs/index.html}javadoc}}.
Test toolkit overview
- {{{mojoTestFramework.html}Mojo test framework}}.
+ see the {{{mojo-testFramework.html}Mojo test framework}} page.
see {{{testapidocs/index.html}test-javadoc}}.
Added: trunk/src/site/apt/mojo-examples.apt
===================================================================
--- trunk/src/site/apt/mojo-examples.apt (rev 0)
+++ trunk/src/site/apt/mojo-examples.apt 2009-10-03 08:58:29 UTC (rev 602)
@@ -0,0 +1,18 @@
+----
+Mojo Examples
+----
+----
+2009-10-02
+----
+
+collect-files
+
+ <<todo>>
+
+send-email
+
+ <<todo>>
+
+share-server-secret
+
+ <<todo>>
\ No newline at end of file
Copied: trunk/src/site/apt/mojo-framework.apt (from rev 600, trunk/src/site/apt/mojoFramework.apt)
===================================================================
--- trunk/src/site/apt/mojo-framework.apt (rev 0)
+++ trunk/src/site/apt/mojo-framework.apt 2009-10-03 08:58:29 UTC (rev 602)
@@ -0,0 +1,40 @@
+----
+Mojo framework
+----
+----
+2009-08-22
+----
+
+Introduction
+
+ This document explains the mojo framework api of <maven-helper-plugin>.
+
+ The <mojo framework> aims to simplify the writing of new mojos.
+
+ To use this framework, your mojo classes <<MUST>> implement the contract
+ <<org.nuiton.plugin.Plugin>>.
+
+ The framework use these technologies :
+
+ * <<java 6>>
+
+ * <<maven 2.2.1>>
+
+How to use it
+
+ Implements the <<org.nuiton.plugin.AbstractPlugin>> class.
+
+ There is some filtering methods :
+
+ * <<checkPackaging>> to test if can perform mojo for the project's packaging.
+
+ * <<init>> : initialize the mojo, and return <<true>> if can execute the mojo.
+
+ The core method is the <<doAction>> one, put there your logic.
+
+Usefull methods
+
+ The <<org.nuiton.plugin.AbstractPlugin>> contains some usefull methods to work
+ around the maven project and io operations on the files of the project.
+
+ For more explanations, see the {{{apidocs/index.html}javadoc}}.
Property changes on: trunk/src/site/apt/mojo-framework.apt
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: trunk/src/site/apt/mojo-testFramework.apt (from rev 600, trunk/src/site/apt/mojoTestFramework.apt)
===================================================================
--- trunk/src/site/apt/mojo-testFramework.apt (rev 0)
+++ trunk/src/site/apt/mojo-testFramework.apt 2009-10-03 08:58:29 UTC (rev 602)
@@ -0,0 +1,177 @@
+----
+Mojo Test framework
+----
+----
+2009-08-22
+----
+
+Introduction
+
+ This document explains to mojo test framework api of <maven-helper-plugin>.
+
+ The <mojo test framework> aims to simplify the writing of tests on a mojo.
+
+ To use this framework, your mojo classes <<MUST>> implement the contract
+ <<org.nuiton.plugin.Plugin>>.
+
+ The framework use these technologies :
+
+ * <<java 6>>
+
+ * <<maven 2.2.1>>
+
+ * <<junit 4.7>>
+
+ * <<maven-plugin-testing-harness 1.2>>.
+
+How to use it
+
+ For each mojo you want to test, implements the <<org.nuiton.plugin.AbstractMojoTest>>
+ class.
+
+ For each mojo's invocation you want to test :
+
+ * write a method with a Junit <<Test>> annotation.
+
+ * write the pom file corresponding to the mojo's invocation to test.
+
+Directory layout of a mojo test
+
+ The mojo test framework api follows a simple directory layout convention :
+
+ * the mojo test class is in the same package as the mojo (respect JUnit convention)
+
+ * the pom files to use for tests are in the sub package with the name of the
+ plugin test class of the test class's package.
+
+ * each test method's name is the file name (suffixed by <.xml>) of the pom to use.
+
+Example
+
+ Having a <<org.nuiton.test.plugin.MyMojo>> class to test, and wants to do
+ two tests <firstTest> and <secondTest>.
+
+ Here is the test class code to produce :
+
+--------------------------------------------------------------------------------
+package org.nuiton.test.plugin;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.nuiton.plugin.AbstractMojoTest;
+
+public class MyMojoTest extends AbstractMojoTest<MyMojo> {
+
+ @Override
+ protected String getGoalName(String methodName) {
+ return "my-goal";
+ }
+
+ @Test
+ public void firstTest() throws Exception {
+
+ MyMojo mojo = getMojo();
+
+ mojo.execute();
+
+ // do my assertions after the goal be executed
+ }
+
+ @Test
+ public void seconTest() throws Exception {
+
+ MyMojo mojo = getMojo();
+
+ mojo.execute();
+
+ // do my assertions after the goal be executed
+ }
+}
+--------------------------------------------------------------------------------
+
+ and writes two pom files names <firstTest.xml> and <secondTest.xml> in directory
+
+--------------------------------------------------------------------------------
+src/test/resources/org/nuiton/test/plugin/MyMojoTest
+--------------------------------------------------------------------------------
+
+ Finally, the next directory tree is what you should have for the example project :
+
+--------------------------------------------------------------------------------
+maven-test-plugin
+|-- pom.xml
+`-- src
+ |-- main
+ | |-- java
+ | | `-- org
+ | | `-- nuiton
+ | | `-- test
+ | | `-- plugin
+ | | `-- MyMojo.java
+ `-- test
+ |-- java
+ | `-- org
+ | `-- nuiton
+ | `-- test
+ | `-- plugin
+ | `-- MyMojoTest.java
+ `-- resources
+ `-- org
+ `-- nuiton
+ `-- test
+ `-- plugin
+ `-- MyMojoTest
+ |-- firstTest.xml
+ `-- secondTest.xml
+--------------------------------------------------------------------------------
+
+Go deeper in AbstractMojoTest
+
+ Often, we could want to do some extra initialization on the mojo before
+ executing it.
+
+ <Note:> There is some limitations of the <maven-plugin-testing-harness> and
+ this is not a real maven execution environement, for example you can not
+ defined in the pom file some properties...
+
+ You can then override the <<setupMojo>> method, like in the next example :
+
+--------------------------------------------------------------------------------
+
+ @Override
+ protected void setUpMojo(MyMojoTest mojo, File pomFile) throws Exception {
+ super.setUpMojo(mojo, pomFile);
+
+ // do your extra pom customization
+ }
+--------------------------------------------------------------------------------
+
+* Changing the default behaviour
+
+ If you do not want to follow the default behaviour, you can override some
+ methods to make the test fits your needs.
+
+ <<Note:>> this is not a good idea to change the default behaviour, since it
+ would be nice that every mojo test respect the conventions to make it easier
+ for every developper (and not only the one who wrote the test case...)
+
+
+--------------------------------------------------------------------------------
+
+ @Override
+ protected MyMojo createMojo(File pomFile, String goalName) throws Exception {
+ return super.createMojo(pomFile, goalName);
+ }
+
+ @Override
+ protected File getPomFile(File testDir, String methodName, String goalName) {
+ return super.getPomFile(testDir, methodName, goalName);
+ }
+
+ @Override
+ protected File getTestDir(String methodName, String goalName) {
+ return super.getTestDir(methodName, goalName);
+ }
+--------------------------------------------------------------------------------
+
+ For more explanations, see the {{{testapidocs/index.html}test-javadoc}}.
Property changes on: trunk/src/site/apt/mojo-testFramework.apt
___________________________________________________________________
Added: svn:mergeinfo
+
Added: trunk/src/site/apt/mojo-usages.apt
===================================================================
--- trunk/src/site/apt/mojo-usages.apt (rev 0)
+++ trunk/src/site/apt/mojo-usages.apt 2009-10-03 08:58:29 UTC (rev 602)
@@ -0,0 +1,59 @@
+----
+Mojo Usages
+----
+----
+2009-10-02
+----
+
+collect-files
+
+ This goal collects some files through a maven build.
+
+ The collected files can be from two sources :
+
+ * files attached to a maven project (as the pom.xml, the jar, the war, ...)
+
+ * extra files you can explicitly add to the files collector.
+
+ The collector can then :
+
+ * copy the collected files into a directory (usage of the <<copyFiles>> and <<outputDirectory>> parameters)
+
+ * copy paths of the collected files into a file (one file per line) (usage of the <<descriptionFile>> parameter)
+
+ * do both (copy files and paths)
+
+ In a multi-module project, the behaviour is to collect datas from all
+ projects in the reactor, and only keep all collected files in the root
+ project.
+
+send-email
+
+ This goal sends an email with a content coming from a file.
+
+share-server-secret
+
+ This goal shares servers informations (from your <settings.xml>)
+ into the maven build.
+
+ The main idea is to use the decrypt mecanism introduce in maven 2.1.0 and
+ make other plugins use these informations <<without>> modifing any other
+ plugin code.
+
+ To use the mojo :
+
+ * you must first indicate the server configuration you want to
+ use via the <<serverId>> configuration.
+
+ * then tell the plugin which information you want to share and the name of
+ properties where to store using the parameters :
+
+ * <<usernameOut>> (to share the username of the server)
+
+ * <<passwordOut>> (to share the password of the server)
+
+ * <<passphraseOut>> (to share to passphrase of the server)
+
+ * After the execution of the mojo, the exported parameters will be available
+ for other mojo via (for example the <${username}> maven property).
+
Deleted: trunk/src/site/apt/mojoFramework.apt
===================================================================
--- trunk/src/site/apt/mojoFramework.apt 2009-10-01 20:44:34 UTC (rev 601)
+++ trunk/src/site/apt/mojoFramework.apt 2009-10-03 08:58:29 UTC (rev 602)
@@ -1,40 +0,0 @@
-----
-Mojo framework
-----
-----
-2009-08-22
-----
-
-Introduction
-
- This document explains the mojo framework api of <maven-helper-plugin>.
-
- The <mojo framework> aims to simplify the writing of new mojos.
-
- To use this framework, your mojo classes <<MUST>> implement the contract
- <<org.nuiton.plugin.Plugin>>.
-
- The framework use these technologies :
-
- * <<java 6>>
-
- * <<maven 2.2.1>>
-
-How to use it
-
- Implements the <<org.nuiton.plugin.AbstractPlugin>> class.
-
- There is some filtering methods :
-
- * <<checkPackaging>> to test if can perform mojo for the project's packaging.
-
- * <<init>> : initialize the mojo, and return <<true>> if can execute the mojo.
-
- The core method is the <<doAction>> one, put there your logic.
-
-Usefull methods
-
- The <<org.nuiton.plugin.AbstractPlugin>> contains some usefull methods to work
- around the maven project and io operations on the files of the project.
-
- For more explanations, see the {{{apidocs/index.html}javadoc}}.
Deleted: trunk/src/site/apt/mojoTestFramework.apt
===================================================================
--- trunk/src/site/apt/mojoTestFramework.apt 2009-10-01 20:44:34 UTC (rev 601)
+++ trunk/src/site/apt/mojoTestFramework.apt 2009-10-03 08:58:29 UTC (rev 602)
@@ -1,177 +0,0 @@
-----
-Mojo Test framework
-----
-----
-2009-08-22
-----
-
-Introduction
-
- This document explains to mojo test framework api of <maven-helper-plugin>.
-
- The <mojo test framework> aims to simplify the writing of tests on a mojo.
-
- To use this framework, your mojo classes <<MUST>> implement the contract
- <<org.nuiton.plugin.Plugin>>.
-
- The framework use these technologies :
-
- * <<java 6>>
-
- * <<maven 2.2.1>>
-
- * <<junit 4.7>>
-
- * <<maven-plugin-testing-harness 1.2>>.
-
-How to use it
-
- For each mojo you want to test, implements the <<org.nuiton.plugin.AbstractMojoTest>>
- class.
-
- For each mojo's invocation you want to test :
-
- * write a method with a Junit <<Test>> annotation.
-
- * write the pom file corresponding to the mojo's invocation to test.
-
-Directory layout of a mojo test
-
- The mojo test framework api follows a simple directory layout convention :
-
- * the mojo test class is in the same package as the mojo (respect JUnit convention)
-
- * the pom files to use for tests are in the sub package with the name of the
- plugin test class of the test class's package.
-
- * each test method's name is the file name (suffixed by <.xml>) of the pom to use.
-
-Example
-
- Having a <<org.nuiton.test.plugin.MyMojo>> class to test, and wants to do
- two tests <firstTest> and <secondTest>.
-
- Here is the test class code to produce :
-
---------------------------------------------------------------------------------
-package org.nuiton.test.plugin;
-
-import static org.junit.Assert.*;
-import org.junit.Test;
-import org.nuiton.plugin.AbstractMojoTest;
-
-public class MyMojoTest extends AbstractMojoTest<MyMojo> {
-
- @Override
- protected String getGoalName(String methodName) {
- return "my-goal";
- }
-
- @Test
- public void firstTest() throws Exception {
-
- MyMojo mojo = getMojo();
-
- mojo.execute();
-
- // do my assertions after the goal be executed
- }
-
- @Test
- public void seconTest() throws Exception {
-
- MyMojo mojo = getMojo();
-
- mojo.execute();
-
- // do my assertions after the goal be executed
- }
-}
---------------------------------------------------------------------------------
-
- and writes two pom files names <firstTest.xml> and <secondTest.xml> in directory
-
---------------------------------------------------------------------------------
-src/test/resources/org/nuiton/test/plugin/MyMojoTest
---------------------------------------------------------------------------------
-
- Finally, the next directory tree is what you should have for the example project :
-
---------------------------------------------------------------------------------
-maven-test-plugin
-|-- pom.xml
-`-- src
- |-- main
- | |-- java
- | | `-- org
- | | `-- nuiton
- | | `-- test
- | | `-- plugin
- | | `-- MyMojo.java
- `-- test
- |-- java
- | `-- org
- | `-- nuiton
- | `-- test
- | `-- plugin
- | `-- MyMojoTest.java
- `-- resources
- `-- org
- `-- nuiton
- `-- test
- `-- plugin
- `-- MyMojoTest
- |-- firstTest.xml
- `-- secondTest.xml
---------------------------------------------------------------------------------
-
-Go deeper in AbstractMojoTest
-
- Often, we could want to do some extra initialization on the mojo before
- executing it.
-
- <Note:> There is some limitations of the <maven-plugin-testing-harness> and
- this is not a real maven execution environement, for example you can not
- defined in the pom file some properties...
-
- You can then override the <<setupMojo>> method, like in the next example :
-
---------------------------------------------------------------------------------
-
- @Override
- protected void setUpMojo(MyMojoTest mojo, File pomFile) throws Exception {
- super.setUpMojo(mojo, pomFile);
-
- // do your extra pom customization
- }
---------------------------------------------------------------------------------
-
-* Changing the default behaviour
-
- If you do not want to follow the default behaviour, you can override some
- methods to make the test fits your needs.
-
- <<Note:>> this is not a good idea to change the default behaviour, since it
- would be nice that every mojo test respect the conventions to make it easier
- for every developper (and not only the one who wrote the test case...)
-
-
---------------------------------------------------------------------------------
-
- @Override
- protected MyMojo createMojo(File pomFile, String goalName) throws Exception {
- return super.createMojo(pomFile, goalName);
- }
-
- @Override
- protected File getPomFile(File testDir, String methodName, String goalName) {
- return super.getPomFile(testDir, methodName, goalName);
- }
-
- @Override
- protected File getTestDir(String methodName, String goalName) {
- return super.getTestDir(methodName, goalName);
- }
---------------------------------------------------------------------------------
-
- For more explanations, see the {{{testapidocs/index.html}test-javadoc}}.
Modified: trunk/src/site/site.xml
===================================================================
--- trunk/src/site/site.xml 2009-10-01 20:44:34 UTC (rev 601)
+++ trunk/src/site/site.xml 2009-10-03 08:58:29 UTC (rev 602)
@@ -40,19 +40,21 @@
<menu name="Utilisateur">
<item name="Introduction" href="index.html"/>
<item name="Goals" href="plugin-info.html">
+ <item name="collect-files" href="collect-files-mojo.html"/>
+ <item name="share-server-secret" href="share-server-secret-mojo.html"/>
+ <item name="send-email" href="send-email-mojo.html"/>
+ <item name="help" href="help-mojo.html"/>
<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="send-email" href="send-email-mojo.html"/>
- <item name="collect-files" href="collect-files-mojo.html"/>
- <item name="help" href="help-mojo.html"/>
- <item name="runJava" href="runJava-mojo.html"/>
</item>
+ <item name="Mojo usages" href="mojo-usages.html"/>
+ <item name="Mojo examples" href="mojo-examples.html"/>
</menu>
<menu name="Développeur">
- <item name="Mojo framework" href="mojoFramework.html"/>
- <item name="Mojo test framework" href="mojoTestFramework.html"/>
+ <item name="Mojo framework" href="mojo-framework.html"/>
+ <item name="Mojo test framework" href="mojo-testFramework.html"/>
<item name="A faire" href="Todo.html"/>
</menu>
1
0
Author: tchemit
Date: 2009-10-01 22:44:34 +0200 (Thu, 01 Oct 2009)
New Revision: 601
Added:
trunk/src/main/java/org/nuiton/plugin/ShareServerSecretPlugin.java
Modified:
trunk/src/main/java/org/nuiton/plugin/CheckProjectFilesPlugin.java
Log:
- Evolution #69: ajout d'un goal pour exposer des secrets du serveur
- le goal CheckProjectFile est un AbstractPlugin
Modified: trunk/src/main/java/org/nuiton/plugin/CheckProjectFilesPlugin.java
===================================================================
--- trunk/src/main/java/org/nuiton/plugin/CheckProjectFilesPlugin.java 2009-09-29 17:47:52 UTC (rev 600)
+++ trunk/src/main/java/org/nuiton/plugin/CheckProjectFilesPlugin.java 2009-10-01 20:44:34 UTC (rev 601)
@@ -21,9 +21,7 @@
package org.nuiton.plugin;
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;
/**
@@ -39,7 +37,7 @@
* @author chemit
* @since 1.0.2
*/
-public class CheckProjectFilesPlugin extends AbstractMojo {
+public class CheckProjectFilesPlugin extends AbstractPlugin {
/**
* Dependance du projet.
@@ -58,7 +56,31 @@
protected boolean verbose;
@Override
- public void execute() throws MojoExecutionException, MojoFailureException {
+ public MavenProject getProject() {
+ return project;
+ }
+
+ @Override
+ public void setProject(MavenProject project) {
+ this.project = project;
+ }
+
+ @Override
+ public boolean isVerbose() {
+ return verbose;
+ }
+
+ @Override
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ @Override
+ protected boolean init() throws Exception {
+ return true;
+ }
+
+ protected void doAction() throws Exception {
checkChangelogFile();
checkReadmeFile();
checkLicenseFile();
Added: trunk/src/main/java/org/nuiton/plugin/ShareServerSecretPlugin.java
===================================================================
--- trunk/src/main/java/org/nuiton/plugin/ShareServerSecretPlugin.java (rev 0)
+++ trunk/src/main/java/org/nuiton/plugin/ShareServerSecretPlugin.java 2009-10-01 20:44:34 UTC (rev 601)
@@ -0,0 +1,182 @@
+package org.nuiton.plugin;
+
+import java.util.Properties;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Server;
+import org.apache.maven.settings.Settings;
+import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
+
+/**
+ * Obtain a server authentication and share it in the maven
+ * project properties.
+ * <p/>
+ * To select data to export from the server with the given {@code serverId},
+ * fill the properties :
+ * <pre>
+ * usernameOut
+ * passwordOut
+ * passphraseOut
+ * </pre>
+ *
+ * @author chemit
+ * @since 1.1.0
+ *
+ * @goal share-server-secret
+ * @phase initialize
+ * @requireProjects true
+ */
+public class ShareServerSecretPlugin extends AbstractPlugin {
+
+ /**
+ * Dependance du projet.
+ *
+ * @parameter default-value="${project}"
+ * @required
+ * @readonly
+ * @since 1.1.0
+ */
+ protected MavenProject project;
+ /**
+ * Dependance du settings.
+ *
+ * @parameter default-value="${settings}"
+ * @required
+ * @readonly
+ * @since 1.1.0
+ */
+ protected Settings settings;
+ /**
+ * Server id to use for authentication (must be defined in your setting
+ * and use the maven >= 2.1.0 password encryption mecanism).
+ * <p/>
+ *
+ * @parameter expression="${helper.serverId}"
+ * @required
+ * @since 1.1.0
+ */
+ protected String serverId;
+ /**
+ * The name of the property where to export the username of the server.
+ * <p/>
+ * <b>Note:</> If not set - then no export of the username of the server.
+ *
+ * @parameter
+ * @since 1.1.0
+ */
+ private String usernameOut;
+ /**
+ * The name of the property where to export the password of the server.
+ * <p/>
+ * <b>Note:</> If not set - then no export of the password of the server.
+ * <p/>
+ * <b>Note:</> If the password is crypted (since maven 2.1.0) then decrypt it.
+ *
+ * @parameter
+ * @since 1.1.0
+ */
+ private String passwordOut;
+ /**
+ * The name of the property where to export the passphrase of the server.
+ * <p/>
+ * <b>Note:</> If not set - then no export of the passphrase of the server.
+ * <p/>
+ * <b>Note:</> If the passphrase is crypted (since maven 2.1.0) then decrypt it.
+ *
+ * @parameter
+ * @since 1.1.0
+ */
+ private String passphraseOut;
+ /**
+ * Un flag pour activer le mode verbeux.
+ *
+ * @parameter expression="${helper.verbose}" default-value="${maven.verbose}"
+ * @since 1.1.0
+ */
+ protected boolean verbose;
+ /**
+ * password decypher
+ *
+ * @component roleHint="maven-helper-plugin"
+ * @since 1.1.0
+ */
+ protected SecDispatcher sec;
+ private boolean exportUsername, exportPassword, exportPassphrase;
+
+ @Override
+ protected boolean init() throws Exception {
+ if (usernameOut != null && !usernameOut.trim().isEmpty()) {
+ exportUsername = true;
+ }
+ if (passwordOut != null && !passwordOut.trim().isEmpty()) {
+ exportPassword = true;
+ }
+ if (passphraseOut != null && !passphraseOut.trim().isEmpty()) {
+ exportPassphrase = true;
+ }
+ if (!(exportUsername || exportPassword || exportPassphrase)) {
+ getLog().error("Nothing to export, you should specify what to export via 'usernameOut', 'passwordOut', 'passphraseOut' parameters.");
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected void doAction() throws Exception {
+ Server server = null;
+
+ if (serverId != null && !serverId.trim().isEmpty()) {
+
+ server = settings.getServer(serverId);
+
+ if (server == null) {
+ throw new MojoExecutionException("Could not find server with id '" + serverId + "', check your settings.xml file.");
+ }
+ }
+
+ Properties properties = project.getModel().getProperties();
+
+ if (exportUsername) {
+
+ String username = server.getUsername();
+ getLog().info("export server [" + serverId + "] username in ${" + usernameOut + "}");
+ properties.setProperty(usernameOut, username);
+ }
+
+ if (exportPassword) {
+ String password = server.getPassword();
+ password = sec.decrypt(server.getPassword());
+
+ getLog().info("export server [" + serverId + "] password in ${" + passwordOut + "}");
+ properties.setProperty(passwordOut, password);
+ }
+
+ if (exportPassphrase) {
+ String passphrase = server.getPassphrase();
+ passphrase = sec.decrypt(server.getPassword());
+
+ getLog().info("export server [" + serverId + "] passphrase in ${" + passphraseOut + "}");
+ properties.setProperty(passphraseOut, passphrase);
+ }
+ }
+
+ @Override
+ public MavenProject getProject() {
+ return project;
+ }
+
+ @Override
+ public void setProject(MavenProject project) {
+ this.project = project;
+ }
+
+ @Override
+ public boolean isVerbose() {
+ return verbose;
+ }
+
+ @Override
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+}
Property changes on: trunk/src/main/java/org/nuiton/plugin/ShareServerSecretPlugin.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
1
0