r876 - in trunk: . helper-maven-plugin helper-maven-plugin/src helper-maven-plugin/src/it helper-maven-plugin/src/it/check-auto-container/central helper-maven-plugin/src/it/check-auto-container/nuiton-other-releases helper-maven-plugin/src/it/check-auto-container/unsafe-central helper-maven-plugin/src/it/collect-files/multi helper-maven-plugin/src/it/collect-files/single helper-maven-plugin/src/it/send-email/single helper-maven-plugin/src/it/share-server-secret/single helper-ma
Author: tchemit Date: 2012-11-11 09:14:19 +0100 (Sun, 11 Nov 2012) New Revision: 876 Url: http://nuiton.org/repositories/revision/maven-helper-plugin/876 Log: refs #2407: Split project in multi-module Added: trunk/helper-maven-plugin-api/src/license/ trunk/helper-maven-plugin-api/src/license/THIRD-PARTY.properties trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/FileUpdater.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/FileUpdaterHelper.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/MirroredFileUpdater.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/PropertiesDateRemoveFilterStream.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/SortedProperties.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/ trunk/helper-maven-plugin-api/src/main/resources/assemblies/ trunk/helper-maven-plugin-api/src/site/ trunk/helper-maven-plugin-api/src/site/apt/ trunk/helper-maven-plugin-api/src/site/apt/mojo-framework.apt trunk/helper-maven-plugin-api/src/site/apt/mojo-testFramework.apt trunk/helper-maven-plugin-api/src/site/site_en.xml trunk/helper-maven-plugin-api/src/test/java/org/nuiton/plugin/ trunk/helper-maven-plugin-api/src/test/resources/META-INF/ trunk/helper-maven-plugin-api/src/test/resources/META-INF/services/ trunk/helper-maven-plugin-api/src/test/resources/log4j.properties trunk/helper-maven-plugin-api/src/test/resources/org/ trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/ trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/ trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/plugin/ trunk/helper-maven-plugin/LICENSE.txt trunk/helper-maven-plugin/src/it/ trunk/helper-maven-plugin/src/license/ trunk/helper-maven-plugin/src/license/THIRD-PARTY.properties trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/io/ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/io/mail/ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/CheckAutoContainerPlugin.java trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ExecuteRemoteCommandMojo.java trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java trunk/helper-maven-plugin/src/main/resources/META-INF/ trunk/helper-maven-plugin/src/main/resources/META-INF/plexus/ trunk/helper-maven-plugin/src/site/ trunk/helper-maven-plugin/src/site/apt/ trunk/helper-maven-plugin/src/site/apt/mojo-examples.apt trunk/helper-maven-plugin/src/site/apt/mojo-usages.apt trunk/helper-maven-plugin/src/site/site_en.xml trunk/helper-maven-plugin/src/test/java/org/nuiton/helper/ trunk/helper-maven-plugin/src/test/java/org/nuiton/helper/plugin/ trunk/helper-maven-plugin/src/test/resources/org/ trunk/helper-maven-plugin/src/test/resources/org/nuiton/ trunk/helper-maven-plugin/src/test/resources/org/nuiton/helper/ trunk/helper-maven-plugin/src/test/resources/org/nuiton/helper/plugin/ Removed: trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/CheckAutoContainerPlugin.java trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ExecuteRemoteCommandMojo.java trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java trunk/src/it/ trunk/src/license/ trunk/src/main/java/org/nuiton/helper/plugin/ trunk/src/main/java/org/nuiton/io/FileUpdater.java trunk/src/main/java/org/nuiton/io/FileUpdaterHelper.java trunk/src/main/java/org/nuiton/io/MirroredFileUpdater.java trunk/src/main/java/org/nuiton/io/PropertiesDateRemoveFilterStream.java trunk/src/main/java/org/nuiton/io/SortedProperties.java trunk/src/main/java/org/nuiton/io/mail/ trunk/src/main/java/org/nuiton/io/xpp3/ trunk/src/main/java/org/nuiton/plugin/ trunk/src/main/resources/META-INF/plexus/ trunk/src/main/resources/assemblies/ 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 trunk/src/test/java/org/nuiton/helper/plugin/ trunk/src/test/java/org/nuiton/plugin/ trunk/src/test/resources/META-INF/services/ trunk/src/test/resources/log4j.properties trunk/src/test/resources/org/nuiton/helper/plugin/ trunk/src/test/resources/org/nuiton/io/ trunk/src/test/resources/org/nuiton/plugin/ Modified: trunk/helper-maven-plugin-api/LICENSE.txt trunk/helper-maven-plugin-api/README.txt trunk/helper-maven-plugin-api/changelog.txt trunk/helper-maven-plugin-api/pom.xml trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/AbstractXpp3Reader.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/AttributeValueToProperty.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/DataConverter.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/DefaultDataConverter.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/PropertyMapper.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/TagContentToProperty.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/TagTextContentToProperty.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/Xpp3Helper.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/Xpp3Reader.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/AbstractAvailableDataMojo.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/AbstractPlugin.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/DependencyUtil.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/Plugin.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/PluginHelper.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/PluginIOContext.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/PluginWithEncoding.java trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/VelocityTemplateGenerator.java trunk/helper-maven-plugin-api/src/main/resources/assemblies/deps.xml trunk/helper-maven-plugin-api/src/main/resources/assemblies/full.xml trunk/helper-maven-plugin-api/src/test/java/org/nuiton/plugin/AbstractMojoTest.java trunk/helper-maven-plugin-api/src/test/java/org/nuiton/plugin/PluginHelperTest.java trunk/helper-maven-plugin-api/src/test/java/org/nuiton/plugin/TestHelper.java trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/JaxxDummy.java trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/JaxxDummy.jaxx trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/xpp3/identities.xml trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/xpp3/identities2.xml trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/xpp3/identity.xml trunk/helper-maven-plugin/README.txt trunk/helper-maven-plugin/changelog.txt trunk/helper-maven-plugin/pom.xml trunk/helper-maven-plugin/src/it/check-auto-container/central/invoker.properties trunk/helper-maven-plugin/src/it/check-auto-container/central/pom.xml trunk/helper-maven-plugin/src/it/check-auto-container/central/verify.groovy trunk/helper-maven-plugin/src/it/check-auto-container/nuiton-other-releases/invoker.properties trunk/helper-maven-plugin/src/it/check-auto-container/nuiton-other-releases/pom.xml trunk/helper-maven-plugin/src/it/check-auto-container/nuiton-other-releases/verify.groovy trunk/helper-maven-plugin/src/it/check-auto-container/unsafe-central/invoker.properties trunk/helper-maven-plugin/src/it/check-auto-container/unsafe-central/pom.xml trunk/helper-maven-plugin/src/it/check-auto-container/unsafe-central/verify.groovy trunk/helper-maven-plugin/src/it/collect-files/multi/invoker.properties trunk/helper-maven-plugin/src/it/collect-files/multi/pom.xml trunk/helper-maven-plugin/src/it/collect-files/multi/verify.groovy trunk/helper-maven-plugin/src/it/collect-files/single/invoker.properties trunk/helper-maven-plugin/src/it/collect-files/single/pom.xml trunk/helper-maven-plugin/src/it/collect-files/single/verify.groovy trunk/helper-maven-plugin/src/it/send-email/single/invoker.properties trunk/helper-maven-plugin/src/it/send-email/single/pom.xml trunk/helper-maven-plugin/src/it/send-email/single/verify.groovy trunk/helper-maven-plugin/src/it/settings.xml trunk/helper-maven-plugin/src/it/share-server-secret/single/invoker.properties trunk/helper-maven-plugin/src/it/share-server-secret/single/pom.xml trunk/helper-maven-plugin/src/it/share-server-secret/single/verify.groovy trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/io/mail/MailSender.java trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/io/mail/ProjectJavamailMailSender.java trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/CollectFilesMojo.java trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/SendEmailMojo.java trunk/helper-maven-plugin/src/main/resources/META-INF/plexus/components.xml trunk/helper-maven-plugin/src/test/java/org/nuiton/helper/plugin/SendEmailMojoTest.java trunk/helper-maven-plugin/src/test/resources/org/nuiton/helper/plugin/sendEmailMojoTest/sendEmail.xml trunk/helper-maven-plugin/src/test/resources/org/nuiton/helper/plugin/sendEmailMojoTest/skipSendEmail.xml trunk/pom.xml trunk/src/site/site_en.xml Added: trunk/helper-maven-plugin/LICENSE.txt =================================================================== --- trunk/helper-maven-plugin/LICENSE.txt (rev 0) +++ trunk/helper-maven-plugin/LICENSE.txt 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + Property changes on: trunk/helper-maven-plugin/LICENSE.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Property changes on: trunk/helper-maven-plugin/README.txt ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Property changes on: trunk/helper-maven-plugin/changelog.txt ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/helper-maven-plugin/pom.xml =================================================================== --- trunk/helper-maven-plugin/pom.xml 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/helper-maven-plugin/pom.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Helper Maven plugin + Helper Maven plugin :: Mojos %% - Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + Copyright (C) 2009 - 2012 Tony Chemit, 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 @@ -20,7 +20,9 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. #L% --> -<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"> +<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> @@ -36,15 +38,6 @@ <packaging>maven-plugin</packaging> - <properties> - - <plexusMailSenderVersion>1.0-alpha-2</plexusMailSenderVersion> - - <!-- extra files to include in release --> - <redmine.releaseFiles>${redmine.libReleaseFiles}</redmine.releaseFiles> - - </properties> - <dependencies> <dependency> @@ -53,45 +46,25 @@ <version>${project.version}</version> </dependency> - <!-- compile dependencies --> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> + <groupId>${project.groupId}</groupId> + <artifactId>helper-maven-plugin-api</artifactId> + <version>${project.version}</version> + <classifier>tests</classifier> </dependency> + <!-- compile dependencies --> + <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </dependency> <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - </dependency> - - <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> - <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <exclusions> - <exclusion> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.apache.maven.shared</groupId> - <artifactId>maven-dependency-tree</artifactId> - <version>1.2</version> - </dependency> - <!-- plexus --> <dependency> @@ -180,11 +153,6 @@ <scope>test</scope> </dependency> - <dependency> - <groupId>velocity</groupId> - <artifactId>velocity</artifactId> - </dependency> - </dependencies> <build> @@ -253,12 +221,14 @@ <reportSets> <reportSet> <reports> + <report>index</report> <report>project-team</report> <report>mailing-list</report> <report>cim</report> <report>issue-tracking</report> <report>license</report> <report>scm</report> + <report>dependency-info</report> <report>dependencies</report> <report>dependency-convergence</report> <report>plugin-management</report> Property changes on: trunk/helper-maven-plugin/pom.xml ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/helper-maven-plugin/src/it/check-auto-container/central/invoker.properties =================================================================== --- trunk/src/it/check-auto-container/central/invoker.properties 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/check-auto-container/central/invoker.properties 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ ### # #%L -# Maven helper plugin -# +# Helper Maven Plugin :: Mojos # $Id$ # $HeadURL$ # %% -# Copyright (C) 2009 - 2010 CodeLutin +# Copyright (C) 2009 - 2012 Codelutin, Tony Chemit # %% # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/check-auto-container/central/pom.xml =================================================================== --- trunk/src/it/check-auto-container/central/pom.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/check-auto-container/central/pom.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: Mojos $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/check-auto-container/central/verify.groovy =================================================================== --- trunk/src/it/check-auto-container/central/verify.groovy 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/check-auto-container/central/verify.groovy 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: Mojos * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -22,5 +21,4 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ - return true; Modified: trunk/helper-maven-plugin/src/it/check-auto-container/nuiton-other-releases/invoker.properties =================================================================== --- trunk/src/it/check-auto-container/nuiton-other-releases/invoker.properties 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/check-auto-container/nuiton-other-releases/invoker.properties 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ ### # #%L -# Maven helper plugin -# +# Helper Maven Plugin :: Mojos # $Id$ # $HeadURL$ # %% -# Copyright (C) 2009 - 2010 CodeLutin +# Copyright (C) 2009 - 2012 Codelutin, Tony Chemit # %% # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/check-auto-container/nuiton-other-releases/pom.xml =================================================================== --- trunk/src/it/check-auto-container/nuiton-other-releases/pom.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/check-auto-container/nuiton-other-releases/pom.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: Mojos $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/check-auto-container/nuiton-other-releases/verify.groovy =================================================================== --- trunk/src/it/check-auto-container/nuiton-other-releases/verify.groovy 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/check-auto-container/nuiton-other-releases/verify.groovy 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: Mojos * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -22,5 +21,4 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ - return true; Modified: trunk/helper-maven-plugin/src/it/check-auto-container/unsafe-central/invoker.properties =================================================================== --- trunk/src/it/check-auto-container/unsafe-central/invoker.properties 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/check-auto-container/unsafe-central/invoker.properties 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ ### # #%L -# Maven helper plugin -# +# Helper Maven Plugin :: Mojos # $Id$ # $HeadURL$ # %% -# Copyright (C) 2009 - 2010 CodeLutin +# Copyright (C) 2009 - 2012 Codelutin, Tony Chemit # %% # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/check-auto-container/unsafe-central/pom.xml =================================================================== --- trunk/src/it/check-auto-container/unsafe-central/pom.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/check-auto-container/unsafe-central/pom.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: Mojos $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/check-auto-container/unsafe-central/verify.groovy =================================================================== --- trunk/src/it/check-auto-container/unsafe-central/verify.groovy 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/check-auto-container/unsafe-central/verify.groovy 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: Mojos * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -22,5 +21,4 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ - return true; Modified: trunk/helper-maven-plugin/src/it/collect-files/multi/invoker.properties =================================================================== --- trunk/src/it/collect-files/multi/invoker.properties 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/collect-files/multi/invoker.properties 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ ### # #%L -# Maven helper plugin -# +# Helper Maven Plugin :: Mojos # $Id$ # $HeadURL$ # %% -# Copyright (C) 2009 - 2010 CodeLutin +# Copyright (C) 2009 - 2012 Codelutin, Tony Chemit # %% # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/collect-files/multi/pom.xml =================================================================== --- trunk/src/it/collect-files/multi/pom.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/collect-files/multi/pom.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: Mojos $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/collect-files/multi/verify.groovy =================================================================== --- trunk/src/it/collect-files/multi/verify.groovy 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/collect-files/multi/verify.groovy 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: Mojos * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -22,6 +21,7 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ + // collect-files assert new File(basedir, 'target/collect.properties').exists(); assert !new File(basedir, 'target/collect').exists(); Modified: trunk/helper-maven-plugin/src/it/collect-files/single/invoker.properties =================================================================== --- trunk/src/it/collect-files/single/invoker.properties 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/collect-files/single/invoker.properties 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ ### # #%L -# Maven helper plugin -# +# Helper Maven Plugin :: Mojos # $Id$ # $HeadURL$ # %% -# Copyright (C) 2009 - 2010 CodeLutin +# Copyright (C) 2009 - 2012 Codelutin, Tony Chemit # %% # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/collect-files/single/pom.xml =================================================================== --- trunk/src/it/collect-files/single/pom.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/collect-files/single/pom.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: Mojos $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/collect-files/single/verify.groovy =================================================================== --- trunk/src/it/collect-files/single/verify.groovy 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/collect-files/single/verify.groovy 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: Mojos * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/send-email/single/invoker.properties =================================================================== --- trunk/src/it/send-email/single/invoker.properties 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/send-email/single/invoker.properties 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ ### # #%L -# Maven helper plugin -# +# Helper Maven Plugin :: Mojos # $Id$ # $HeadURL$ # %% -# Copyright (C) 2009 - 2010 CodeLutin +# Copyright (C) 2009 - 2012 Codelutin, Tony Chemit # %% # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/send-email/single/pom.xml =================================================================== --- trunk/src/it/send-email/single/pom.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/send-email/single/pom.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: Mojos $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/send-email/single/verify.groovy =================================================================== --- trunk/src/it/send-email/single/verify.groovy 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/send-email/single/verify.groovy 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: Mojos * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -22,25 +21,6 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ assert new File(basedir, 'build.log').exists(); //content = new File(basedir, 'build.log').text; Modified: trunk/helper-maven-plugin/src/it/settings.xml =================================================================== --- trunk/src/it/settings.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/settings.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: Mojos $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/share-server-secret/single/invoker.properties =================================================================== --- trunk/src/it/share-server-secret/single/invoker.properties 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/share-server-secret/single/invoker.properties 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ ### # #%L -# Maven helper plugin -# +# Helper Maven Plugin :: Mojos # $Id$ # $HeadURL$ # %% -# Copyright (C) 2009 - 2010 CodeLutin +# Copyright (C) 2009 - 2012 Codelutin, Tony Chemit # %% # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/share-server-secret/single/pom.xml =================================================================== --- trunk/src/it/share-server-secret/single/pom.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/share-server-secret/single/pom.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: Mojos $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin/src/it/share-server-secret/single/verify.groovy =================================================================== --- trunk/src/it/share-server-secret/single/verify.groovy 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/it/share-server-secret/single/verify.groovy 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: Mojos * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as Added: trunk/helper-maven-plugin/src/license/THIRD-PARTY.properties =================================================================== --- trunk/helper-maven-plugin/src/license/THIRD-PARTY.properties (rev 0) +++ trunk/helper-maven-plugin/src/license/THIRD-PARTY.properties 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,30 @@ +# Generated by org.codehaus.mojo.license.AddThirdPartyMojo +#------------------------------------------------------------------------------- +# Already used licenses in project : +# - Apache License +# - Apache Public License 2.0 +# - BSD License +# - BSD style +# - CDDL +# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 +# - Common Public License Version 1.0 +# - GPLv2+CE +# - Indiana University Extreme! Lab Software License, vesion 1.1.1 +# - Lesser General Public License (LGPL) v 3.0 +# - Lesser General Public License (LPGL) +# - Lesser General Public License (LPGL) v 2.1 +# - MIT License +# - Public Domain +# - The Apache Software License, Version 2.0 +# - http://classworlds.codehaus.org/license.html +#------------------------------------------------------------------------------- +# Please fill the missing licenses for dependencies : +# +# +#Sun Nov 11 08:56:53 CET 2012 +classworlds--classworlds--1.1-alpha-2=http\://classworlds.codehaus.org/license.html +commons-cli--commons-cli--1.0=The Apache Software License, Version 2.0 +org.codehaus.plexus--plexus-container-default--1.0-alpha-9-stable-1=The Apache Software License, Version 2.0 +org.codehaus.plexus--plexus-interactivity-api--1.0-alpha-4=The Apache Software License, Version 2.0 +oro--oro--2.0.8=The Apache Software License, Version 2.0 +plexus--plexus-mail-sender-api--1.0-alpha-2=The Apache Software License, Version 2.0 Property changes on: trunk/helper-maven-plugin/src/license/THIRD-PARTY.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/io/mail/MailSender.java =================================================================== --- trunk/src/main/java/org/nuiton/io/mail/MailSender.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/io/mail/MailSender.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.helper.io.mail; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: Mojos * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.io.mail; - /** * Defines the sender of a email. * Modified: trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/io/mail/ProjectJavamailMailSender.java =================================================================== --- trunk/src/main/java/org/nuiton/io/mail/ProjectJavamailMailSender.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/io/mail/ProjectJavamailMailSender.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.helper.io.mail; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: Mojos * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.io.mail; - import org.codehaus.plexus.mailsender.AbstractMailSender; import org.codehaus.plexus.mailsender.MailMessage; import org.codehaus.plexus.mailsender.MailSenderException; Deleted: trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/CheckAutoContainerPlugin.java =================================================================== --- trunk/src/main/java/org/nuiton/helper/plugin/CheckAutoContainerPlugin.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/CheckAutoContainerPlugin.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,583 +0,0 @@ -/* - * #%L - * Maven helper plugin - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Tony Chemit, 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>. - * #L% - */ - -package org.nuiton.helper.plugin; - - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.manager.WagonManager; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; -import org.apache.maven.artifact.resolver.ArtifactResolver; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugin.logging.Log; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.apache.maven.project.MavenProject; -import org.apache.maven.settings.Proxy; -import org.apache.maven.wagon.ConnectionException; -import org.apache.maven.wagon.Wagon; -import org.apache.maven.wagon.authentication.AuthenticationInfo; -import org.apache.maven.wagon.observers.Debug; -import org.apache.maven.wagon.proxy.ProxyInfo; -import org.apache.maven.wagon.repository.Repository; -import org.codehaus.plexus.util.StringUtils; -import org.nuiton.plugin.AbstractPlugin; -import org.nuiton.plugin.PluginHelper; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -/** - * Check all dependencies are auto contained in the given repositories. - * - * @author tchemit <chemit@codelutin.com> - * @version $Id$ - * @since 1.2.5 - */ -@Mojo(name = "check-auto-container", defaultPhase = LifecyclePhase.VALIDATE, requiresProject = true, requiresOnline = true, requiresDependencyResolution = ResolutionScope.RUNTIME) -public class CheckAutoContainerPlugin extends AbstractPlugin { - - /** - * Map of repositories to use. - * <p/> - * Keys are repository id and Values are repository url. - * - * @since 1.2.5 - */ - @Parameter - protected Map<String, String> repositories; - - /** - * A flag to add the maven central repository http://repo1.maven.org/maven2 - * to {@link #repositories}. - * - * @since 1.2.5 - */ - @Parameter(property = "addMavenCentral", defaultValue = "false") - protected boolean addMavenCentral; - - /** - * A flag to fail if project is not auto container. - * - * @since 1.2.5 - */ - @Parameter(property = "helper.failIfNotSafe", defaultValue = "false") - protected boolean failIfNotSafe; - - /** - * A flag to activate verbose mode. - * - * @since 1.2.5 - */ - @Parameter(property = "helper.verbose", defaultValue = "${maven.verbose}") - protected boolean verbose; - - /** - * A flag to execute only once the mojo. - * <p/> - * <b>Note:</b> By default, value is {@code true} since it is not necessary - * to check twice for a same artifact. - * - * @since 1.2.6 - */ - @Parameter(property = "helper.runOnce", defaultValue = "true") - protected boolean runOnce; - - /** - * Project. - * - * @since 1.2.5 - */ - @Component - protected MavenProject project; - - /** - * The projects in reactor (used to detected sibling dependencies). - * - * @since 1.2.5 - */ - @Parameter(property = "reactorProjects", readonly = true) - protected List<?> reactorProjects; - - /** - * Active proxy from settings (if any). - * - * @since 1.2.5 - */ - @Parameter(property = "settings.activeProxy", required = true, readonly = true) - protected Proxy proxy; - - /** - * Local repository. - * - * @since 1.2.5 - */ - @Parameter(property = "localRepository", required = true, readonly = true) - protected ArtifactRepository localRepository; - - /** - * Artifact repository factory component. - * - * @since 1.2.5 - */ - @Component - protected ArtifactRepositoryFactory artifactRepositoryFactory; - - /** - * Artifact factory component. - * - * @since 1.2.5 - */ - @Component - protected ArtifactFactory factory; - - /** - * Artifact resolver component. - * - * @since 1.2.5 - */ - @Component - protected ArtifactResolver resolver; - - /** - * Wagon manager component. - * - * @since 1.2.5 - */ - @Component - protected WagonManager wagonManager; - - /** - * Authorized Remote Repositories. - * - * @since 1.2.5 - */ - private List<ArtifactRepository> safeRepositories; - - /** - * List of artifacts to treate. - * - * @since 1.2.5 - */ - private List<Artifact> artifacts; - - /** - * Dictionnary of already resolved artifacts (keys are repository url and - * values are list of artifact ids). - * - * @since 1.2.5 - */ - private static Map<String, List<String>> resolved; - - public static final String MAVEN_CENTRAL_ID = "maven-central"; - - public static final String MAVEN_CENTRAL_URL = "http://repo1.maven.org/maven2/"; - - private boolean wasAlreadyExecuted; - - @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 - public void init() throws Exception { - - Log log = getLog(); - - if (log.isDebugEnabled()) { - - // always be verbose in debug mode - setVerbose(true); - } - - if (runOnce) { - - boolean wasAlreadyExecuted = checkAlreadyExecuted(); - - if (wasAlreadyExecuted) { - return; - } - - } - - safeRepositories = createSafeRepositories(); - - artifacts = prepareArtifacts(); - - if (isVerbose()) { - log.info(artifacts.size() + " detected dependencies : "); - for (Object artifact : artifacts) { - log.info(" - " + artifact); - } - } - } - - protected boolean checkAlreadyExecuted() { - // compute the unique key refering to parameters of plugin - - StringBuilder buffer = new StringBuilder("check-auto-container##"); - Artifact artifact = project.getArtifact(); - buffer.append(artifact.getGroupId()).append(":"); - buffer.append(artifact.getArtifactId()).append(":"); - buffer.append(artifact.getVersion()).append("##"); - - // check if plugin was already done. - - String key = buffer.toString(); - - if (verbose) { - getLog().info("check if already done for key : " + key); - } - Object value = project.getProperties().get(key); - if (value != null) { - // ok was already done - wasAlreadyExecuted = true; - } - long timestamp = System.nanoTime(); - project.getProperties().put(key, timestamp + ""); - if (verbose) { - getLog().info("Adding cache key " + key + - " with timestamp " + timestamp); - } - return wasAlreadyExecuted; - } - - @Override - protected boolean checkSkip() { - if (runOnce && wasAlreadyExecuted) { - - // ok was already done - getLog().info("Goal was already executed, will skip goal."); - return false; - } - - if (artifacts.isEmpty()) { - getLog().info("Project has no dependecy."); - return false; - } - - if (repositories.isEmpty()) { - getLog().info("No repository defined."); - return false; - } - return super.checkSkip(); - } - - @Override - protected void doAction() throws Exception { - - Log log = getLog(); - - log.info(artifacts.size() + " dependencies to check."); - - for (ArtifactRepository repository : safeRepositories) { - - if (artifacts.isEmpty()) { - - // no more artifacts to check - continue; - } - long t0 = System.nanoTime(); - String url = repository.getUrl(); - - List<String> ids = getRepositoryCache(url); - Wagon wagon = getWagon(repository); - try { - if (verbose) { - log.info("Use repository " + url); - } - List<Artifact> found = checkDependency(repository, wagon, ids); - long delay = System.nanoTime() - t0; - String message; - if (found.isEmpty()) { - message = "No artifact resolved by the repository " + url; - } else { - message = String.format("%1$4s artifact(s) resolved by repository %2$s in %3$s", found.size(), url, PluginHelper.convertTime(delay)); - } - log.info(message); - artifacts.removeAll(found); - - } finally { - disconnect(wagon); - } - } - - boolean safe = artifacts.isEmpty(); - - if (safe) { - log.info("All dependencies are safe."); - return; - } - - log.warn("There is " + artifacts.size() + " unsafe dependencie(s) :"); - for (Object artifact : artifacts) { - log.warn(" - " + artifact); - } - if (failIfNotSafe) { - throw new MojoFailureException("There is still some unsafe dependencies."); - } - } - - protected List<ArtifactRepository> createSafeRepositories() { - List<ArtifactRepository> safeRepositories = new ArrayList<ArtifactRepository>(); - - ArtifactRepositoryLayout repositoryLayout = new DefaultRepositoryLayout(); - if (repositories == null) { - repositories = new TreeMap<String, String>(); - } - List<String> ids = new ArrayList<String>(repositories.keySet()); - if (addMavenCentral) { - - ids.add(0, MAVEN_CENTRAL_ID); - repositories.put(MAVEN_CENTRAL_ID, MAVEN_CENTRAL_URL); - } - - for (String id : ids) { - String url = repositories.get(id); - url = url.trim(); - - ArtifactRepository repo; - repo = artifactRepositoryFactory.createDeploymentArtifactRepository( - String.valueOf(id), - url, - repositoryLayout, true); - - getLog().info("Will use repository " + repo.getUrl()); - if (verbose) { - getLog().info(repo.toString()); - } - safeRepositories.add(repo); - } - return safeRepositories; - } - - protected List<Artifact> prepareArtifacts() { - - List<Artifact> result = new ArrayList<Artifact>(); - - List<String> siblings = new ArrayList<String>(); - - for (Object o : reactorProjects) { - MavenProject m = (MavenProject) o; - siblings.add(getArtifactId(m.getArtifact())); - } - - // treate classic dependencies - for (Object o : project.getArtifacts()) { - Artifact a = (Artifact) o; - Artifact artifact = acceptArtifact(a, siblings); - if (artifact != null) { - result.add(a); - } - } - - // treate also plugin dependencies - for (Object o : project.getPluginArtifacts()) { - Artifact a = (Artifact) o; - Artifact artifact = acceptArtifact(a, siblings); - if (artifact != null) { - result.add(a); - } - } - return result; - } - - protected Artifact acceptArtifact(Artifact a, List<String> siblings) { - String id = getArtifactId(a); - - if (siblings.contains(id)) { - - // skip a sibling dependency - if (verbose) { - getLog().info("Skip sibling dependency : " + id); - } - return null; - } - - if (a.isSnapshot()) { - - // skip snapshot - getLog().warn("Skip SNAPSHOT dependency : " + id); - return null; - } - - Artifact artifact = ArtifactUtils.copyArtifact(a); - - // force artifact not to be treated - artifact.setResolved(false); - - // will treate this artifact - return artifact; - } - - private List<Artifact> checkDependency(ArtifactRepository repo, - Wagon wagon, - List<String> ids) throws Exception { - Log log = getLog(); - List<Artifact> result = new ArrayList<Artifact>(); - String url = repo.getUrl(); - - for (Artifact artifact : artifacts) { - if (log.isDebugEnabled()) { - log.debug(" - check artifact : " + artifact); - } - String id = getArtifactId(artifact); - - boolean resolved; - boolean inCache = ids.contains(id); - if (inCache) { - - // already resolved - resolved = true; - } else { - - // first time resolving this artifact - Artifact copyArtifact = ArtifactUtils.copyArtifact(artifact); - - String path = url + "/" + repo.pathOf(copyArtifact); - - resolved = wagon.resourceExists(StringUtils.replace(path, repo.getUrl(), "")); - } - - if (resolved) { - - if (verbose) { - log.info(" - [ resolved ] " + artifact + (inCache ? " (from cache)" : "")); - } - result.add(artifact); - ids.add(id); - } else { - if (log.isDebugEnabled()) { - log.debug(" - [unresolved] " + artifact); - } - } - } - return result; - } - - protected String getArtifactId(Artifact artifact) { - String id = artifact.getGroupId() + ":" + - artifact.getArtifactId() + ":" + - artifact.getVersion(); - return id; - } - - protected List<String> getRepositoryCache(String url) { - if (resolved == null) { - resolved = new TreeMap<String, List<String>>(); - } - List<String> ids = resolved.get(url); - if (ids == null) { - ids = new ArrayList<String>(); - resolved.put(url, ids); - } - return ids; - } - - - protected Wagon getWagon(ArtifactRepository repo) throws Exception { - - Repository repository = new Repository(repo.getId(), repo.getUrl()); - Wagon wagon = wagonManager.getWagon(repository); - - wagon.setTimeout(1000); - - if (getLog().isDebugEnabled()) { - Debug debug = new Debug(); - - wagon.addSessionListener(debug); - wagon.addTransferListener(debug); - } - - // FIXME when upgrading to maven 3.x : this must be changed. - AuthenticationInfo auth = wagonManager.getAuthenticationInfo(repo.getId()); - - ProxyInfo proxyInfo = getProxyInfo(); - if (proxyInfo != null) { - wagon.connect(repository, auth, proxyInfo); - } else { - wagon.connect(repository, auth); - } - - return wagon; - } - - protected void disconnect(Wagon wagon) { - try { - wagon.disconnect(); - } - catch (ConnectionException e) { - Log log = getLog(); - if (log.isDebugEnabled()) { - log.error("Error disconnecting wagon - ignored", e); - } else { - log.error("Error disconnecting wagon - ignored"); - } - } - } - - protected ProxyInfo getProxyInfo() { - ProxyInfo proxyInfo = null; - if (proxy != null && !StringUtils.isEmpty(proxy.getHost())) { - - proxyInfo = new ProxyInfo(); - proxyInfo.setHost(proxy.getHost()); - proxyInfo.setType(proxy.getProtocol()); - proxyInfo.setPort(proxy.getPort()); - proxyInfo.setNonProxyHosts(proxy.getNonProxyHosts()); - proxyInfo.setUserName(proxy.getUsername()); - proxyInfo.setPassword(proxy.getPassword()); - } - - return proxyInfo; - } - -} \ No newline at end of file Copied: trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/CheckAutoContainerPlugin.java (from rev 874, trunk/src/main/java/org/nuiton/helper/plugin/CheckAutoContainerPlugin.java) =================================================================== --- trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/CheckAutoContainerPlugin.java (rev 0) +++ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/CheckAutoContainerPlugin.java 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,585 @@ +package org.nuiton.helper.plugin; + +/* + * #%L + * Helper Maven Plugin :: Mojos + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit + * %% + * 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>. + * #L% + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.manager.WagonManager; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; +import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; +import org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.project.MavenProject; +import org.apache.maven.settings.Proxy; +import org.apache.maven.wagon.ConnectionException; +import org.apache.maven.wagon.Wagon; +import org.apache.maven.wagon.authentication.AuthenticationInfo; +import org.apache.maven.wagon.observers.Debug; +import org.apache.maven.wagon.proxy.ProxyInfo; +import org.apache.maven.wagon.repository.Repository; +import org.codehaus.plexus.util.StringUtils; +import org.nuiton.plugin.AbstractPlugin; +import org.nuiton.plugin.PluginHelper; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +/** + * Check all dependencies are auto contained in the given repositories. + * + * @author tchemit <chemit@codelutin.com> + * @version $Id$ + * @since 1.2.5 + */ +@Mojo(name = "check-auto-container", + defaultPhase = LifecyclePhase.VALIDATE, + requiresProject = true, + requiresOnline = true, + requiresDependencyResolution = ResolutionScope.RUNTIME) +public class CheckAutoContainerPlugin extends AbstractPlugin { + + /** + * Map of repositories to use. + * <p/> + * Keys are repository id and Values are repository url. + * + * @since 1.2.5 + */ + @Parameter + protected Map<String, String> repositories; + + /** + * A flag to add the maven central repository http://repo1.maven.org/maven2 + * to {@link #repositories}. + * + * @since 1.2.5 + */ + @Parameter(property = "addMavenCentral", defaultValue = "false") + protected boolean addMavenCentral; + + /** + * A flag to fail if project is not auto container. + * + * @since 1.2.5 + */ + @Parameter(property = "helper.failIfNotSafe", defaultValue = "false") + protected boolean failIfNotSafe; + + /** + * A flag to activate verbose mode. + * + * @since 1.2.5 + */ + @Parameter(property = "helper.verbose", defaultValue = "${maven.verbose}") + protected boolean verbose; + + /** + * A flag to execute only once the mojo. + * <p/> + * <b>Note:</b> By default, value is {@code true} since it is not necessary + * to check twice for a same artifact. + * + * @since 1.2.6 + */ + @Parameter(property = "helper.runOnce", defaultValue = "true") + protected boolean runOnce; + + /** + * Project. + * + * @since 1.2.5 + */ + @Component + protected MavenProject project; + + /** + * The projects in reactor (used to detected sibling dependencies). + * + * @since 1.2.5 + */ + @Parameter(property = "reactorProjects", readonly = true) + protected List<?> reactorProjects; + + /** + * Active proxy from settings (if any). + * + * @since 1.2.5 + */ + @Parameter(property = "settings.activeProxy", required = true, readonly = true) + protected Proxy proxy; + + /** + * Local repository. + * + * @since 1.2.5 + */ + @Parameter(property = "localRepository", required = true, readonly = true) + protected ArtifactRepository localRepository; + + /** + * Artifact repository factory component. + * + * @since 1.2.5 + */ + @Component + protected ArtifactRepositoryFactory artifactRepositoryFactory; + + /** + * Artifact factory component. + * + * @since 1.2.5 + */ + @Component + protected ArtifactFactory factory; + + /** + * Artifact resolver component. + * + * @since 1.2.5 + */ + @Component + protected ArtifactResolver resolver; + + /** + * Wagon manager component. + * + * @since 1.2.5 + */ + @Component + protected WagonManager wagonManager; + + /** + * Authorized Remote Repositories. + * + * @since 1.2.5 + */ + private List<ArtifactRepository> safeRepositories; + + /** + * List of artifacts to treate. + * + * @since 1.2.5 + */ + private List<Artifact> artifacts; + + /** + * Dictionnary of already resolved artifacts (keys are repository url and + * values are list of artifact ids). + * + * @since 1.2.5 + */ + private static Map<String, List<String>> resolved; + + public static final String MAVEN_CENTRAL_ID = "maven-central"; + + public static final String MAVEN_CENTRAL_URL = "http://repo1.maven.org/maven2/"; + + private boolean wasAlreadyExecuted; + + @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 + public void init() throws Exception { + + Log log = getLog(); + + if (log.isDebugEnabled()) { + + // always be verbose in debug mode + setVerbose(true); + } + + if (runOnce) { + + boolean wasAlreadyExecuted = checkAlreadyExecuted(); + + if (wasAlreadyExecuted) { + return; + } + + } + + safeRepositories = createSafeRepositories(); + + artifacts = prepareArtifacts(); + + if (isVerbose()) { + log.info(artifacts.size() + " detected dependencies : "); + for (Object artifact : artifacts) { + log.info(" - " + artifact); + } + } + } + + protected boolean checkAlreadyExecuted() { + // compute the unique key refering to parameters of plugin + + StringBuilder buffer = new StringBuilder("check-auto-container##"); + Artifact artifact = project.getArtifact(); + buffer.append(artifact.getGroupId()).append(":"); + buffer.append(artifact.getArtifactId()).append(":"); + buffer.append(artifact.getVersion()).append("##"); + + // check if plugin was already done. + + String key = buffer.toString(); + + if (verbose) { + getLog().info("check if already done for key : " + key); + } + Object value = project.getProperties().get(key); + if (value != null) { + // ok was already done + wasAlreadyExecuted = true; + } + long timestamp = System.nanoTime(); + project.getProperties().put(key, timestamp + ""); + if (verbose) { + getLog().info("Adding cache key " + key + + " with timestamp " + timestamp); + } + return wasAlreadyExecuted; + } + + @Override + protected boolean checkSkip() { + if (runOnce && wasAlreadyExecuted) { + + // ok was already done + getLog().info("Goal was already executed, will skip goal."); + return false; + } + + if (artifacts.isEmpty()) { + getLog().info("Project has no dependecy."); + return false; + } + + if (repositories.isEmpty()) { + getLog().info("No repository defined."); + return false; + } + return super.checkSkip(); + } + + @Override + protected void doAction() throws Exception { + + Log log = getLog(); + + log.info(artifacts.size() + " dependencies to check."); + + for (ArtifactRepository repository : safeRepositories) { + + if (artifacts.isEmpty()) { + + // no more artifacts to check + continue; + } + long t0 = System.nanoTime(); + String url = repository.getUrl(); + + List<String> ids = getRepositoryCache(url); + Wagon wagon = getWagon(repository); + try { + if (verbose) { + log.info("Use repository " + url); + } + List<Artifact> found = checkDependency(repository, wagon, ids); + long delay = System.nanoTime() - t0; + String message; + if (found.isEmpty()) { + message = "No artifact resolved by the repository " + url; + } else { + message = String.format("%1$4s artifact(s) resolved by repository %2$s in %3$s", found.size(), url, PluginHelper.convertTime(delay)); + } + log.info(message); + artifacts.removeAll(found); + + } finally { + disconnect(wagon); + } + } + + boolean safe = artifacts.isEmpty(); + + if (safe) { + log.info("All dependencies are safe."); + return; + } + + log.warn("There is " + artifacts.size() + " unsafe dependencie(s) :"); + for (Object artifact : artifacts) { + log.warn(" - " + artifact); + } + if (failIfNotSafe) { + throw new MojoFailureException("There is still some unsafe dependencies."); + } + } + + protected List<ArtifactRepository> createSafeRepositories() { + List<ArtifactRepository> safeRepositories = new ArrayList<ArtifactRepository>(); + + ArtifactRepositoryLayout repositoryLayout = new DefaultRepositoryLayout(); + if (repositories == null) { + repositories = new TreeMap<String, String>(); + } + List<String> ids = new ArrayList<String>(repositories.keySet()); + if (addMavenCentral) { + + ids.add(0, MAVEN_CENTRAL_ID); + repositories.put(MAVEN_CENTRAL_ID, MAVEN_CENTRAL_URL); + } + + for (String id : ids) { + String url = repositories.get(id); + url = url.trim(); + + ArtifactRepository repo; + repo = artifactRepositoryFactory.createDeploymentArtifactRepository( + String.valueOf(id), + url, + repositoryLayout, true); + + getLog().info("Will use repository " + repo.getUrl()); + if (verbose) { + getLog().info(repo.toString()); + } + safeRepositories.add(repo); + } + return safeRepositories; + } + + protected List<Artifact> prepareArtifacts() { + + List<Artifact> result = new ArrayList<Artifact>(); + + List<String> siblings = new ArrayList<String>(); + + for (Object o : reactorProjects) { + MavenProject m = (MavenProject) o; + siblings.add(getArtifactId(m.getArtifact())); + } + + // treate classic dependencies + for (Object o : project.getArtifacts()) { + Artifact a = (Artifact) o; + Artifact artifact = acceptArtifact(a, siblings); + if (artifact != null) { + result.add(a); + } + } + + // treate also plugin dependencies + for (Object o : project.getPluginArtifacts()) { + Artifact a = (Artifact) o; + Artifact artifact = acceptArtifact(a, siblings); + if (artifact != null) { + result.add(a); + } + } + return result; + } + + protected Artifact acceptArtifact(Artifact a, List<String> siblings) { + String id = getArtifactId(a); + + if (siblings.contains(id)) { + + // skip a sibling dependency + if (verbose) { + getLog().info("Skip sibling dependency : " + id); + } + return null; + } + + if (a.isSnapshot()) { + + // skip snapshot + getLog().warn("Skip SNAPSHOT dependency : " + id); + return null; + } + + Artifact artifact = ArtifactUtils.copyArtifact(a); + + // force artifact not to be treated + artifact.setResolved(false); + + // will treate this artifact + return artifact; + } + + private List<Artifact> checkDependency(ArtifactRepository repo, + Wagon wagon, + List<String> ids) throws Exception { + Log log = getLog(); + List<Artifact> result = new ArrayList<Artifact>(); + String url = repo.getUrl(); + + for (Artifact artifact : artifacts) { + if (log.isDebugEnabled()) { + log.debug(" - check artifact : " + artifact); + } + String id = getArtifactId(artifact); + + boolean resolved; + boolean inCache = ids.contains(id); + if (inCache) { + + // already resolved + resolved = true; + } else { + + // first time resolving this artifact + Artifact copyArtifact = ArtifactUtils.copyArtifact(artifact); + + String path = url + "/" + repo.pathOf(copyArtifact); + + resolved = wagon.resourceExists(StringUtils.replace(path, repo.getUrl(), "")); + } + + if (resolved) { + + if (verbose) { + log.info(" - [ resolved ] " + artifact + (inCache ? " (from cache)" : "")); + } + result.add(artifact); + ids.add(id); + } else { + if (log.isDebugEnabled()) { + log.debug(" - [unresolved] " + artifact); + } + } + } + return result; + } + + protected String getArtifactId(Artifact artifact) { + String id = artifact.getGroupId() + ":" + + artifact.getArtifactId() + ":" + + artifact.getVersion(); + return id; + } + + protected List<String> getRepositoryCache(String url) { + if (resolved == null) { + resolved = new TreeMap<String, List<String>>(); + } + List<String> ids = resolved.get(url); + if (ids == null) { + ids = new ArrayList<String>(); + resolved.put(url, ids); + } + return ids; + } + + + protected Wagon getWagon(ArtifactRepository repo) throws Exception { + + Repository repository = new Repository(repo.getId(), repo.getUrl()); + Wagon wagon = wagonManager.getWagon(repository); + + wagon.setTimeout(1000); + + if (getLog().isDebugEnabled()) { + Debug debug = new Debug(); + + wagon.addSessionListener(debug); + wagon.addTransferListener(debug); + } + + // FIXME when upgrading to maven 3.x : this must be changed. + AuthenticationInfo auth = wagonManager.getAuthenticationInfo(repo.getId()); + + ProxyInfo proxyInfo = getProxyInfo(); + if (proxyInfo != null) { + wagon.connect(repository, auth, proxyInfo); + } else { + wagon.connect(repository, auth); + } + + return wagon; + } + + protected void disconnect(Wagon wagon) { + try { + wagon.disconnect(); + } + catch (ConnectionException e) { + Log log = getLog(); + if (log.isDebugEnabled()) { + log.error("Error disconnecting wagon - ignored", e); + } else { + log.error("Error disconnecting wagon - ignored"); + } + } + } + + protected ProxyInfo getProxyInfo() { + ProxyInfo proxyInfo = null; + if (proxy != null && !StringUtils.isEmpty(proxy.getHost())) { + + proxyInfo = new ProxyInfo(); + proxyInfo.setHost(proxy.getHost()); + proxyInfo.setType(proxy.getProtocol()); + proxyInfo.setPort(proxy.getPort()); + proxyInfo.setNonProxyHosts(proxy.getNonProxyHosts()); + proxyInfo.setUserName(proxy.getUsername()); + proxyInfo.setPassword(proxy.getPassword()); + } + + return proxyInfo; + } + +} \ No newline at end of file Modified: trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/CollectFilesMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/helper/plugin/CollectFilesMojo.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/CollectFilesMojo.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.helper.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: Mojos * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.helper.plugin; - import org.apache.commons.lang3.StringUtils; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.metadata.ArtifactMetadata; Deleted: trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ExecuteRemoteCommandMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/helper/plugin/ExecuteRemoteCommandMojo.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ExecuteRemoteCommandMojo.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,231 +0,0 @@ -/* - * #%L - * Maven helper plugin - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2012 Tony Chemit, 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>. - * #L% - */ -package org.nuiton.helper.plugin; - -import org.apache.commons.lang3.StringUtils; -import org.apache.maven.artifact.manager.WagonManager; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.logging.Log; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Server; -import org.apache.maven.settings.Settings; -import org.apache.maven.wagon.CommandExecutor; -import org.apache.maven.wagon.ConnectionException; -import org.apache.maven.wagon.Wagon; -import org.apache.maven.wagon.authentication.AuthenticationInfo; -import org.apache.maven.wagon.observers.Debug; -import org.apache.maven.wagon.proxy.ProxyInfo; -import org.apache.maven.wagon.repository.Repository; -import org.nuiton.plugin.AbstractPlugin; - -/** - * Mojo to execute on a remote server some scripts. - * - * @author tchemit <chemit@codelutin.com> - * @since 1.3.1 - */ -@Mojo(name = "execute-remote-command", defaultPhase = LifecyclePhase.VALIDATE, - requiresOnline = true, requiresProject = true) -public class ExecuteRemoteCommandMojo extends AbstractPlugin { - - /** A flag to activate verbose mode. */ - @Parameter(property = "helper.verbose", defaultValue = "${maven.verbose}") - protected boolean verbose; - - /** Project. */ - @Component - protected MavenProject project; - - /** Active proxy from settings (if any). */ - @Parameter(defaultValue = "${settings.activeProxy}", required = true, readonly = true) - protected Proxy proxy; - - /** - * Settings. - * - * @since 1.1.0 - */ - @Component - protected Settings settings; - - /** - * Id of the server to use to obtain user login. - * <p/> - * Must be found in your settings.xml. - */ - @Parameter(property = "helper.repositoryId", required = true) - protected String repositoryId; - - /** - * Url where to execute script. - * <p/> - * The url must contains the wagon protocol (says scp:... or scpexe:...). - */ - @Parameter(property = "helper.repositoryUrl", required = true) - protected String repositoryUrl; - - /** Command to execute on remote server. */ - @Parameter(property = "helper.command", required = true) - protected String command; - - /** Wagon manager component. */ - @Component - protected WagonManager wagonManager; - - private CommandExecutor commandExecutor; - - @Override - protected void init() throws Exception { - - Log log = getLog(); - - if (log.isDebugEnabled()) { - - // always be verbose in debug mode - setVerbose(true); - } - - if (StringUtils.isEmpty(repositoryId)) { - throw new MojoExecutionException("No 'repositoryId' defined."); - } - - Server server = settings.getServer(repositoryId.trim()); - - if (server == null) { - throw new MojoExecutionException( - "Could not find server with id '" + repositoryId + - "', check your settings.xml file."); - } - - Repository repository = new Repository(repositoryId, repositoryUrl); - Wagon wagon = getWagon(repository); - - if (!(wagon instanceof CommandExecutor)) { - - disconnect(wagon); - - throw new MojoExecutionException( - "The wagon " + wagon + " is not a command executor, " + - "will not be able to execute command."); - } - - commandExecutor = (CommandExecutor) wagon; - } - - @Override - protected void doAction() throws Exception { - - if (isVerbose()) { - getLog().info("Will execute command : " + command); - } - try { - commandExecutor.executeCommand(command); - } finally { - - disconnect(commandExecutor); - } - } - - @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; - } - - protected Wagon getWagon(Repository repository) throws Exception { - - Wagon wagon = wagonManager.getWagon(repository); - - wagon.setTimeout(1000); - - if (getLog().isDebugEnabled()) { - Debug debug = new Debug(); - - wagon.addSessionListener(debug); - wagon.addTransferListener(debug); - } - - // FIXME when upgrading to maven 3.x : this must be changed. - AuthenticationInfo auth = - wagonManager.getAuthenticationInfo(repository.getId()); - - ProxyInfo proxyInfo = getProxyInfo(); - if (proxyInfo != null) { - wagon.connect(repository, auth, proxyInfo); - } else { - wagon.connect(repository, auth); - } - - return wagon; - } - - protected void disconnect(Wagon wagon) { - try { - wagon.disconnect(); - } catch (ConnectionException e) { - Log log = getLog(); - if (log.isDebugEnabled()) { - log.error("Error disconnecting wagon - ignored", e); - } else { - log.error("Error disconnecting wagon - ignored"); - } - } - } - - protected ProxyInfo getProxyInfo() { - ProxyInfo proxyInfo = null; - if (proxy != null && !StringUtils.isEmpty(proxy.getHost())) { - - proxyInfo = new ProxyInfo(); - proxyInfo.setHost(proxy.getHost()); - proxyInfo.setType(proxy.getProtocol()); - proxyInfo.setPort(proxy.getPort()); - proxyInfo.setNonProxyHosts(proxy.getNonProxyHosts()); - proxyInfo.setUserName(proxy.getUsername()); - proxyInfo.setPassword(proxy.getPassword()); - } - - return proxyInfo; - } -} Copied: trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ExecuteRemoteCommandMojo.java (from rev 874, trunk/src/main/java/org/nuiton/helper/plugin/ExecuteRemoteCommandMojo.java) =================================================================== --- trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ExecuteRemoteCommandMojo.java (rev 0) +++ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ExecuteRemoteCommandMojo.java 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,233 @@ +package org.nuiton.helper.plugin; + +/* + * #%L + * Helper Maven Plugin :: Mojos + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit + * %% + * 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>. + * #L% + */ + +import org.apache.commons.lang3.StringUtils; +import org.apache.maven.artifact.manager.WagonManager; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.apache.maven.settings.Proxy; +import org.apache.maven.settings.Server; +import org.apache.maven.settings.Settings; +import org.apache.maven.wagon.CommandExecutor; +import org.apache.maven.wagon.ConnectionException; +import org.apache.maven.wagon.Wagon; +import org.apache.maven.wagon.authentication.AuthenticationInfo; +import org.apache.maven.wagon.observers.Debug; +import org.apache.maven.wagon.proxy.ProxyInfo; +import org.apache.maven.wagon.repository.Repository; +import org.nuiton.plugin.AbstractPlugin; + +/** + * Mojo to execute on a remote server some scripts. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.3.1 + */ +@Mojo(name = "execute-remote-command", + defaultPhase = LifecyclePhase.VALIDATE, + requiresOnline = true, + requiresProject = true) +public class ExecuteRemoteCommandMojo extends AbstractPlugin { + + /** A flag to activate verbose mode. */ + @Parameter(property = "helper.verbose", defaultValue = "${maven.verbose}") + protected boolean verbose; + + /** Project. */ + @Component + protected MavenProject project; + + /** Active proxy from settings (if any). */ + @Parameter(defaultValue = "${settings.activeProxy}", required = true, readonly = true) + protected Proxy proxy; + + /** + * Settings. + * + * @since 1.1.0 + */ + @Component + protected Settings settings; + + /** + * Id of the server to use to obtain user login. + * <p/> + * Must be found in your settings.xml. + */ + @Parameter(property = "helper.repositoryId", required = true) + protected String repositoryId; + + /** + * Url where to execute script. + * <p/> + * The url must contains the wagon protocol (says scp:... or scpexe:...). + */ + @Parameter(property = "helper.repositoryUrl", required = true) + protected String repositoryUrl; + + /** Command to execute on remote server. */ + @Parameter(property = "helper.command", required = true) + protected String command; + + /** Wagon manager component. */ + @Component + protected WagonManager wagonManager; + + private CommandExecutor commandExecutor; + + @Override + protected void init() throws Exception { + + Log log = getLog(); + + if (log.isDebugEnabled()) { + + // always be verbose in debug mode + setVerbose(true); + } + + if (StringUtils.isEmpty(repositoryId)) { + throw new MojoExecutionException("No 'repositoryId' defined."); + } + + Server server = settings.getServer(repositoryId.trim()); + + if (server == null) { + throw new MojoExecutionException( + "Could not find server with id '" + repositoryId + + "', check your settings.xml file."); + } + + Repository repository = new Repository(repositoryId, repositoryUrl); + Wagon wagon = getWagon(repository); + + if (!(wagon instanceof CommandExecutor)) { + + disconnect(wagon); + + throw new MojoExecutionException( + "The wagon " + wagon + " is not a command executor, " + + "will not be able to execute command."); + } + + commandExecutor = (CommandExecutor) wagon; + } + + @Override + protected void doAction() throws Exception { + + if (isVerbose()) { + getLog().info("Will execute command : " + command); + } + try { + commandExecutor.executeCommand(command); + } finally { + + disconnect(commandExecutor); + } + } + + @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; + } + + protected Wagon getWagon(Repository repository) throws Exception { + + Wagon wagon = wagonManager.getWagon(repository); + + wagon.setTimeout(1000); + + if (getLog().isDebugEnabled()) { + Debug debug = new Debug(); + + wagon.addSessionListener(debug); + wagon.addTransferListener(debug); + } + + // FIXME when upgrading to maven 3.x : this must be changed. + AuthenticationInfo auth = + wagonManager.getAuthenticationInfo(repository.getId()); + + ProxyInfo proxyInfo = getProxyInfo(); + if (proxyInfo != null) { + wagon.connect(repository, auth, proxyInfo); + } else { + wagon.connect(repository, auth); + } + + return wagon; + } + + protected void disconnect(Wagon wagon) { + try { + wagon.disconnect(); + } catch (ConnectionException e) { + Log log = getLog(); + if (log.isDebugEnabled()) { + log.error("Error disconnecting wagon - ignored", e); + } else { + log.error("Error disconnecting wagon - ignored"); + } + } + } + + protected ProxyInfo getProxyInfo() { + ProxyInfo proxyInfo = null; + if (proxy != null && !StringUtils.isEmpty(proxy.getHost())) { + + proxyInfo = new ProxyInfo(); + proxyInfo.setHost(proxy.getHost()); + proxyInfo.setType(proxy.getProtocol()); + proxyInfo.setPort(proxy.getPort()); + proxyInfo.setNonProxyHosts(proxy.getNonProxyHosts()); + proxyInfo.setUserName(proxy.getUsername()); + proxyInfo.setPassword(proxy.getPassword()); + } + + return proxyInfo; + } +} Modified: trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/SendEmailMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/helper/plugin/SendEmailMojo.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/SendEmailMojo.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.helper.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: Mojos * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.helper.plugin; - import org.apache.commons.lang3.StringUtils; import org.apache.maven.model.Developer; import org.apache.maven.plugin.MojoExecutionException; @@ -36,8 +35,8 @@ import org.codehaus.plexus.logging.console.ConsoleLogger; import org.codehaus.plexus.mailsender.MailMessage; import org.codehaus.plexus.mailsender.MailSenderException; -import org.nuiton.io.mail.MailSender; -import org.nuiton.io.mail.ProjectJavamailMailSender; +import org.nuiton.helper.io.mail.MailSender; +import org.nuiton.helper.io.mail.ProjectJavamailMailSender; import org.nuiton.plugin.AbstractPlugin; import org.nuiton.plugin.PluginHelper; import org.nuiton.plugin.PluginWithEncoding; Deleted: trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java =================================================================== --- trunk/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,388 +0,0 @@ -/* - * #%L - * Maven helper plugin - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Tony Chemit, 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>. - * #L% - */ - -package org.nuiton.helper.plugin; - -import org.apache.commons.lang3.StringUtils; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; -import org.apache.maven.settings.Server; -import org.apache.maven.settings.Settings; -import org.nuiton.plugin.AbstractPlugin; -import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; - -import java.util.EnumMap; -import java.util.Map; -import java.util.Properties; - -/** - * 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 - * privateKeyOut - * passphraseOut - * </pre> - * - * @author tchemit <chemit@codelutin.com> - * @since 1.1.0 - */ -@Mojo(name = "share-server-secret", defaultPhase = LifecyclePhase.INITIALIZE, requiresProject = true) -public class ShareServerSecretPlugin extends AbstractPlugin { - - /** - * Project. - * - * @since 1.1.0 - */ - @Component - protected MavenProject project; - - /** - * Settings. - * - * @since 1.1.0 - */ - @Component - 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/> - * - * @since 1.1.0 - */ - @Parameter(property = "helper.serverId", required = true) - protected String serverId; - - /** - * The name of the property where to export the username of the server. - * <p/> - * <b>Note:</b> If not set - then no export of the username of the server. - * - * @since 1.1.0 - */ - @Parameter - protected String usernameOut; - - /** - * The name of the property where to export the password of the server. - * <p/> - * <b>Note:</b> If not set - then no export of the password of the server. - * <p/> - * <b>Note:</b> If the password is crypted (since maven 2.1.0) then - * decrypt it. - * - * @since 1.1.0 - */ - @Parameter - protected String passwordOut; - - /** - * The name of the property where to export the passphrase of the server. - * <p/> - * <b>Note:</b> If not set - then no export of the passphrase of the server. - * <p/> - * <b>Note:</b> If the passphrase is crypted (since maven 2.1.0) then - * decrypt it. - * - * @since 1.1.0 - */ - @Parameter - protected String passphraseOut; - - /** - * The name of the property where to export the private key of the server. - * <p/> - * <b>Note:</b> If not set - then no export of the private key of the server. - * - * @since 1.1.0 - */ - @Parameter - protected String privateKeyOut; - - /** - * A flag to activate verbose mode. - * - * @since 1.1.0 - */ - @Parameter(property = "helper.verbose", defaultValue = "${maven.verbose}") - protected boolean verbose; - - /** - * A flag to execute only once the mojo. - * <p/> - * <b>Note:</b> By default, value is {@code true} since it is not necessary - * to inject twice secrets in session. - * - * @since 1.1.0 - */ - @Parameter(property = "helper.runOnce", defaultValue = "true") - protected boolean runOnce; - - /** - * A flag to skip null values. - * - * @since 1.6 - */ - @Parameter(property = "helper.skipNullValues", defaultValue = "false") - protected boolean skipNullValues; - - /** - * password decypher - * - * @since 1.1.0 - */ - @Component(hint = "maven-helper-plugin") - protected SecDispatcher sec; - - /** the server to use to obtain secrets */ - private Server server; - - /** server secrets to expose */ - private Map<Property, String> propertiesToTreate; - - public enum Property { - username { - @Override - public String getSecret(Server server) { - return server.getUsername(); - } - }, - password { - @Override - public String getSecret(Server server) { - return server.getPassword(); - } - }, - passphrase { - @Override - public String getSecret(Server server) { - return server.getPassphrase(); - } - }, - privateKey { - @Override - public String getSecret(Server server) { - return server.getPrivateKey(); - } - }; - - public abstract String getSecret(Server server); - } - - @Override - public void init() throws Exception { - - propertiesToTreate = new EnumMap<Property, String>(Property.class); - - if (StringUtils.isNotEmpty(usernameOut)) { - propertiesToTreate.put(Property.username, usernameOut); - } - if (StringUtils.isNotEmpty(passwordOut)) { - propertiesToTreate.put(Property.password, passwordOut); - } - if (StringUtils.isNotEmpty(passphraseOut)) { - propertiesToTreate.put(Property.passphrase, passphraseOut); - } - if (StringUtils.isNotEmpty(privateKeyOut)) { - propertiesToTreate.put(Property.privateKey, privateKeyOut); - } - if (propertiesToTreate.isEmpty()) { - throw new MojoExecutionException( - "Nothing to export, you should specify what to " + - "export via 'usernameOut', 'passwordOut', " + - "'passphraseOut' or 'privateKeyOut' parameters."); - } - - if (StringUtils.isEmpty(serverId)) { - throw new MojoExecutionException("No 'serverId' defined."); - } - - server = settings.getServer(serverId.trim()); - - if (server == null) { - throw new MojoExecutionException( - "Could not find server with id '" + serverId + - "', check your settings.xml file."); - } - } - - @Override - public boolean checkSkip() { - if (runOnce) { - - // compute the unique key refering to parameters of plugin - - StringBuilder buffer = new StringBuilder("share-secret##"); - buffer.append(serverId); - buffer.append("##"); - for (Map.Entry<Property, String> entry : - propertiesToTreate.entrySet()) { - buffer.append(entry.getKey()).append(entry.getValue()); - } - // check if plugin was already done. - - String key = buffer.toString(); - - if (verbose) { - getLog().info("check if already done for key : " + key); - } - Object value = project.getProperties().get(key); - if (value != null) { - // ok was already done - getLog().info("Goal was already executed, will skip goal."); - return false; - } - long timestamp = System.nanoTime(); - project.getProperties().put(key, timestamp + ""); - if (verbose) { - getLog().info("Adding cache key " + key + - " with timestamp " + timestamp); - } - - } - return true; - } - - @Override - protected void doAction() throws Exception { - - Properties properties = project.getModel().getProperties(); - - for (Map.Entry<Property, String> entry : - propertiesToTreate.entrySet()) { - Property key = entry.getKey(); - String propertyValue = key.getSecret(server); - String propertyTargetName = entry.getValue(); - - if (isVerbose()) { - getLog().info("will decrypt [" + key + "] : " + propertyValue); - } - propertyValue = sec.decrypt(propertyValue); - - if (propertyValue == null) { - if (skipNullValues) { - getLog().warn("no export server [" + serverId + "] " + key.name() + - " in ${" + propertyTargetName + "} (null value)"); - - } else { - throw new MojoExecutionException( - "Null values found for server [" + - serverId + "] " + key.name() + - ", use skipNullValue to authrize it."); - } - - } else { - - getLog().info("export server [" + serverId + "] " + key.name() + - " in ${" + propertyTargetName + "}"); - - properties.setProperty(propertyTargetName, propertyValue); - } - } - } - - @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; - } - - public String getPassphraseOut() { - return passphraseOut; - } - - public void setPassphraseOut(String passphraseOut) { - this.passphraseOut = passphraseOut; - } - - public String getPasswordOut() { - return passwordOut; - } - - public void setPasswordOut(String passwordOut) { - this.passwordOut = passwordOut; - } - - public String getPrivateKeyOut() { - return privateKeyOut; - } - - public void setPrivateKeyOut(String privateKeyOut) { - this.privateKeyOut = privateKeyOut; - } - - public String getUsernameOut() { - return usernameOut; - } - - public void setUsernameOut(String usernameOut) { - this.usernameOut = usernameOut; - } - - public String getServerId() { - return serverId; - } - - public void setServerId(String serverId) { - this.serverId = serverId; - } - - public void setSec(SecDispatcher sec) { - this.sec = sec; - } - - public void setSettings(Settings settings) { - this.settings = settings; - } - - public void setRunOnce(boolean runOnce) { - this.runOnce = runOnce; - } -} Copied: trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java (from rev 874, trunk/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java) =================================================================== --- trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java (rev 0) +++ trunk/helper-maven-plugin/src/main/java/org/nuiton/helper/plugin/ShareServerSecretPlugin.java 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,389 @@ +package org.nuiton.helper.plugin; + +/* + * #%L + * Helper Maven Plugin :: Mojos + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit + * %% + * 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>. + * #L% + */ + +import org.apache.commons.lang3.StringUtils; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.apache.maven.settings.Server; +import org.apache.maven.settings.Settings; +import org.nuiton.plugin.AbstractPlugin; +import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; + +import java.util.EnumMap; +import java.util.Map; +import java.util.Properties; + +/** + * 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 + * privateKeyOut + * passphraseOut + * </pre> + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1.0 + */ +@Mojo(name = "share-server-secret", + defaultPhase = LifecyclePhase.INITIALIZE, + requiresProject = true) +public class ShareServerSecretPlugin extends AbstractPlugin { + + /** + * Project. + * + * @since 1.1.0 + */ + @Component + protected MavenProject project; + + /** + * Settings. + * + * @since 1.1.0 + */ + @Component + 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/> + * + * @since 1.1.0 + */ + @Parameter(property = "helper.serverId", required = true) + protected String serverId; + + /** + * The name of the property where to export the username of the server. + * <p/> + * <b>Note:</b> If not set - then no export of the username of the server. + * + * @since 1.1.0 + */ + @Parameter + protected String usernameOut; + + /** + * The name of the property where to export the password of the server. + * <p/> + * <b>Note:</b> If not set - then no export of the password of the server. + * <p/> + * <b>Note:</b> If the password is crypted (since maven 2.1.0) then + * decrypt it. + * + * @since 1.1.0 + */ + @Parameter + protected String passwordOut; + + /** + * The name of the property where to export the passphrase of the server. + * <p/> + * <b>Note:</b> If not set - then no export of the passphrase of the server. + * <p/> + * <b>Note:</b> If the passphrase is crypted (since maven 2.1.0) then + * decrypt it. + * + * @since 1.1.0 + */ + @Parameter + protected String passphraseOut; + + /** + * The name of the property where to export the private key of the server. + * <p/> + * <b>Note:</b> If not set - then no export of the private key of the server. + * + * @since 1.1.0 + */ + @Parameter + protected String privateKeyOut; + + /** + * A flag to activate verbose mode. + * + * @since 1.1.0 + */ + @Parameter(property = "helper.verbose", defaultValue = "${maven.verbose}") + protected boolean verbose; + + /** + * A flag to execute only once the mojo. + * <p/> + * <b>Note:</b> By default, value is {@code true} since it is not necessary + * to inject twice secrets in session. + * + * @since 1.1.0 + */ + @Parameter(property = "helper.runOnce", defaultValue = "true") + protected boolean runOnce; + + /** + * A flag to skip null values. + * + * @since 1.6 + */ + @Parameter(property = "helper.skipNullValues", defaultValue = "false") + protected boolean skipNullValues; + + /** + * password decypher + * + * @since 1.1.0 + */ + @Component(hint = "maven-helper-plugin") + protected SecDispatcher sec; + + /** the server to use to obtain secrets */ + private Server server; + + /** server secrets to expose */ + private Map<Property, String> propertiesToTreate; + + public enum Property { + username { + @Override + public String getSecret(Server server) { + return server.getUsername(); + } + }, + password { + @Override + public String getSecret(Server server) { + return server.getPassword(); + } + }, + passphrase { + @Override + public String getSecret(Server server) { + return server.getPassphrase(); + } + }, + privateKey { + @Override + public String getSecret(Server server) { + return server.getPrivateKey(); + } + }; + + public abstract String getSecret(Server server); + } + + @Override + public void init() throws Exception { + + propertiesToTreate = new EnumMap<Property, String>(Property.class); + + if (StringUtils.isNotEmpty(usernameOut)) { + propertiesToTreate.put(Property.username, usernameOut); + } + if (StringUtils.isNotEmpty(passwordOut)) { + propertiesToTreate.put(Property.password, passwordOut); + } + if (StringUtils.isNotEmpty(passphraseOut)) { + propertiesToTreate.put(Property.passphrase, passphraseOut); + } + if (StringUtils.isNotEmpty(privateKeyOut)) { + propertiesToTreate.put(Property.privateKey, privateKeyOut); + } + if (propertiesToTreate.isEmpty()) { + throw new MojoExecutionException( + "Nothing to export, you should specify what to " + + "export via 'usernameOut', 'passwordOut', " + + "'passphraseOut' or 'privateKeyOut' parameters."); + } + + if (StringUtils.isEmpty(serverId)) { + throw new MojoExecutionException("No 'serverId' defined."); + } + + server = settings.getServer(serverId.trim()); + + if (server == null) { + throw new MojoExecutionException( + "Could not find server with id '" + serverId + + "', check your settings.xml file."); + } + } + + @Override + public boolean checkSkip() { + if (runOnce) { + + // compute the unique key refering to parameters of plugin + + StringBuilder buffer = new StringBuilder("share-secret##"); + buffer.append(serverId); + buffer.append("##"); + for (Map.Entry<Property, String> entry : + propertiesToTreate.entrySet()) { + buffer.append(entry.getKey()).append(entry.getValue()); + } + // check if plugin was already done. + + String key = buffer.toString(); + + if (verbose) { + getLog().info("check if already done for key : " + key); + } + Object value = project.getProperties().get(key); + if (value != null) { + // ok was already done + getLog().info("Goal was already executed, will skip goal."); + return false; + } + long timestamp = System.nanoTime(); + project.getProperties().put(key, timestamp + ""); + if (verbose) { + getLog().info("Adding cache key " + key + + " with timestamp " + timestamp); + } + + } + return true; + } + + @Override + protected void doAction() throws Exception { + + Properties properties = project.getModel().getProperties(); + + for (Map.Entry<Property, String> entry : + propertiesToTreate.entrySet()) { + Property key = entry.getKey(); + String propertyValue = key.getSecret(server); + String propertyTargetName = entry.getValue(); + + if (isVerbose()) { + getLog().info("will decrypt [" + key + "] : " + propertyValue); + } + propertyValue = sec.decrypt(propertyValue); + + if (propertyValue == null) { + if (skipNullValues) { + getLog().warn("no export server [" + serverId + "] " + key.name() + + " in ${" + propertyTargetName + "} (null value)"); + + } else { + throw new MojoExecutionException( + "Null values found for server [" + + serverId + "] " + key.name() + + ", use skipNullValue to authrize it."); + } + + } else { + + getLog().info("export server [" + serverId + "] " + key.name() + + " in ${" + propertyTargetName + "}"); + + properties.setProperty(propertyTargetName, propertyValue); + } + } + } + + @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; + } + + public String getPassphraseOut() { + return passphraseOut; + } + + public void setPassphraseOut(String passphraseOut) { + this.passphraseOut = passphraseOut; + } + + public String getPasswordOut() { + return passwordOut; + } + + public void setPasswordOut(String passwordOut) { + this.passwordOut = passwordOut; + } + + public String getPrivateKeyOut() { + return privateKeyOut; + } + + public void setPrivateKeyOut(String privateKeyOut) { + this.privateKeyOut = privateKeyOut; + } + + public String getUsernameOut() { + return usernameOut; + } + + public void setUsernameOut(String usernameOut) { + this.usernameOut = usernameOut; + } + + public String getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } + + public void setSec(SecDispatcher sec) { + this.sec = sec; + } + + public void setSettings(Settings settings) { + this.settings = settings; + } + + public void setRunOnce(boolean runOnce) { + this.runOnce = runOnce; + } +} Modified: trunk/helper-maven-plugin/src/main/resources/META-INF/plexus/components.xml =================================================================== --- trunk/src/main/resources/META-INF/plexus/components.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/main/resources/META-INF/plexus/components.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: Mojos $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Copied: trunk/helper-maven-plugin/src/site/apt/mojo-examples.apt (from rev 872, trunk/src/site/apt/mojo-examples.apt) =================================================================== --- trunk/helper-maven-plugin/src/site/apt/mojo-examples.apt (rev 0) +++ trunk/helper-maven-plugin/src/site/apt/mojo-examples.apt 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,178 @@ +~~~ +~~ #%L +~~ Helper Maven Plugin :: Mojos +~~ $Id$ +~~ $HeadURL$ +~~ %% +~~ Copyright (C) 2009 - 2012 Codelutin, Tony Chemit +~~ %% +~~ 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>. +~~ #L% +~~~ +---- +Mojo Examples +---- +---- +2009-10-02 +---- + +collect-files + + Collects the <<LICENSE.txt>> file and store reference in + <<target/collects.txt>>. + +------------------------------------------------------------------------------ +<plugin> + <groupId>org.nuiton</groupId> + <artifactId>helper-maven-plugin</artifactId> + <executions> + <execution> + <id>collect-files</id> + <goals> + <goal>collect-files</goal> + </goals> + <phase>generate-resources</phase> + <configuration> + <extraFiles>LICENSE.txt</extraFiles> + <descriptionFile>target/collects.txt</descriptionFile> + </configuration> + </execution> + + </executions> +</plugin> +------------------------------------------------------------------------------ + +share-server-secret + + Shares the secret of <<yourserverId>> says : + + * <<privateKey>> + + * <<password>> + + * <<username>> + + * <<passphrase>> + +------------------------------------------------------------------------------ +<plugin> + <groupId>org.nuiton</groupId> + <artifactId>helper-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>share-server-secret</goal> + </goals> + <phase>validate</phase> + <configuration> + <serverId>yourServerId</serverId> + <privateKeyOut>privateKey</privateKeyOut> + <passwordOut>password</passwordOut> + <usernameOut>username</usernameOut> + <passphraseOut>passphrase</passphraseOut> + </configuration> + </execution> + </executions> +</plugin> +------------------------------------------------------------------------------ + +send-email + + Sends a email from <<noreply@noway.fr>> to <<receiver@noway.com>>. + + the content of the email is in <<target/emailContent.txt>>. + +------------------------------------------------------------------------------ +<plugin> + <groupId>org.nuiton</groupId> + <artifactId>helper-maven-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@noway.fr</email> + </mailSender> + <toAddresses> + <item>receiver@noway.com</item> + </toAddresses> + <smtpHost>smtp</smtpHost> + </configuration> +</plugin> +------------------------------------------------------------------------------ + +check-auto-container + + To test if all depencies of a project are in maven central repository : + +-------------------------------------------------------------------------------- +<plugin> +<groupId>org.nuiton</groupId> +<artifactId>helper-maven-plugin</artifactId> +<executions> + <execution> + <id>check-central-safe</id> + <inherited>true</inherited> + <goals> + <goal>check-auto-container</goal> + </goals> + <phase>validate</phase> + <configuration> + <addMavenCentral>true</addMavenCentral> + </configuration> + </execution> +</executions> +</plugin> +-------------------------------------------------------------------------------- + + To test if all depencies of a project are in the repository : + + * id : <<nuiton-central-releases>> + + * url : <<http://nexus.nuiton.org/nexus/content/repositories/nuiton-central-releases>> + +-------------------------------------------------------------------------------- +<plugin> +<groupId>org.nuiton</groupId> +<artifactId>helper-maven-plugin</artifactId> +<executions> + <execution> + <id>check-central-safe</id> + <inherited>true</inherited> + <goals> + <goal>check-auto-container</goal> + </goals> + <phase>validate</phase> + <configuration> + <repositories> + <nuiton-central-releases> + http://nexus.nuiton.org/nexus/content/repositories/nuiton-central-releases + </nuiton-central-releases> + </repositories> + </configuration> + </execution> +</executions> +</plugin> +-------------------------------------------------------------------------------- Property changes on: trunk/helper-maven-plugin/src/site/apt/mojo-examples.apt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/helper-maven-plugin/src/site/apt/mojo-usages.apt (from rev 872, trunk/src/site/apt/mojo-usages.apt) =================================================================== --- trunk/helper-maven-plugin/src/site/apt/mojo-usages.apt (rev 0) +++ trunk/helper-maven-plugin/src/site/apt/mojo-usages.apt 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,109 @@ +~~~ +~~ #%L +~~ Helper Maven Plugin :: Mojos +~~ $Id$ +~~ $HeadURL$ +~~ %% +~~ Copyright (C) 2009 - 2012 Codelutin, Tony Chemit +~~ %% +~~ 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>. +~~ #L% +~~~ +---- +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. + + + See {{{./mojo-examples.html#collect-files}examples page}}. + +send-email + + This goal sends an email with a content coming from a file. + + See {{{./mojo-examples.html#send-email}examples page}}. + +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) + + * <<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). + + + See {{{./mojo-examples.html#share-server-secret}examples page}}. + +check-auto-container + + This mojo permits to test if all dependencies of a project are auto-contained + in given repositories. + + To use the mojo : + + * fill <<addCentralMaven>> to add central maven repository. + + * fill <<repositoriess>> to add more repositories to test. + + * use <<failIfNotSafe>> to fail build if there is some unsafe dependencies. + + [] + + See {{{./mojo-examples.html#check-auto-container}examples page}}. + \ No newline at end of file Property changes on: trunk/helper-maven-plugin/src/site/apt/mojo-usages.apt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/helper-maven-plugin/src/site/site_en.xml (from rev 872, trunk/src/site/site_en.xml) =================================================================== --- trunk/helper-maven-plugin/src/site/site_en.xml (rev 0) +++ trunk/helper-maven-plugin/src/site/site_en.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Helper Maven Plugin :: Mojos + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit + %% + 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>. + #L% + --> + +<project name="${project.name}"> + + <bannerLeft> + <name>${project.name}</name> + <href>index.html</href> + </bannerLeft> + + <body> + + <header> + <script type="text/javascript" + src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js"> + </script> + </header> + + <breadcrumbs> + <item name="${project.name}" href="index.html"/> + </breadcrumbs> + + <menu name="User"> + <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="check-auto-container" href="check-auto-container-mojo.html"/> + <item name="help" href="help-mojo.html"/> + </item> + <item name="Mojo usages" href="mojo-usages.html"/> + <item name="Mojo examples" href="mojo-examples.html"/> + </menu> + + <menu ref="reports"/> + + <footer> + + + <div id='projectMetas' + projectversion='${project.version}' + platform='${project.platform}' + projectid='${project.projectId}' + scm='${project.scm.developerConnection}' + scmwebeditorenabled='${project.scmwebeditorEnabled}' + scmwebeditorurl='${project.scmwebeditorUrl}' + siteSourcesType='${project.siteSourcesType}' + piwikEnabled='${project.piwikEnabled}' + piwikId='${project.piwikId}'> + </div> + </footer> + + </body> +</project> Modified: trunk/helper-maven-plugin/src/test/java/org/nuiton/helper/plugin/SendEmailMojoTest.java =================================================================== --- trunk/src/test/java/org/nuiton/helper/plugin/SendEmailMojoTest.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/test/java/org/nuiton/helper/plugin/SendEmailMojoTest.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.helper.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: Mojos * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,14 +24,12 @@ * #L% */ -package org.nuiton.helper.plugin; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assert; import org.junit.Assume; import org.junit.Test; -import org.nuiton.io.mail.MailSender; +import org.nuiton.helper.io.mail.MailSender; import org.nuiton.plugin.AbstractMojoTest; import java.io.File; Modified: trunk/helper-maven-plugin/src/test/resources/org/nuiton/helper/plugin/sendEmailMojoTest/sendEmail.xml =================================================================== --- trunk/src/test/resources/org/nuiton/helper/plugin/sendEmailMojoTest/sendEmail.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/test/resources/org/nuiton/helper/plugin/sendEmailMojoTest/sendEmail.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: Mojos $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -28,41 +27,43 @@ 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>test-send-email</artifactId> - <version>0</version> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.test</groupId> + <artifactId>test-send-email</artifactId> + <version>0</version> - <build> + <build> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>helper-maven-plugin</artifactId> - <configuration> - <emailContentFile>target/test-classes/org/nuiton/mail/plugin/sendEmailMojoTest/mailContentFile.txt</emailContentFile> - <emailTitle>[ANNOUNCEMENT] - One 1.0.0 released</emailTitle> - <encoding>UTF-8</encoding> - <skipSendEmail>false</skipSendEmail> - <!--<mailSender> - <name>Nuiton Release Notification</name> - <email>noreply@${platform}</email> - </mailSender> - <toAddresses> - <item>chemit@codelutin.com</item> - </toAddresses>--> - <smtpHost>smtp</smtpHost> - <smtpPort>25</smtpPort> - <dryRun>true</dryRun> - </configuration> - <executions> - <execution> - <goals> - <goal>send-email</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>helper-maven-plugin</artifactId> + <configuration> + <emailContentFile> + target/test-classes/org/nuiton/mail/plugin/sendEmailMojoTest/mailContentFile.txt + </emailContentFile> + <emailTitle>[ANNOUNCEMENT] - One 1.0.0 released</emailTitle> + <encoding>UTF-8</encoding> + <skipSendEmail>false</skipSendEmail> + <!--<mailSender> + <name>Nuiton Release Notification</name> + <email>noreply@${platform}</email> + </mailSender> + <toAddresses> + <item>chemit@codelutin.com</item> + </toAddresses>--> + <smtpHost>smtp</smtpHost> + <smtpPort>25</smtpPort> + <dryRun>true</dryRun> + </configuration> + <executions> + <execution> + <goals> + <goal>send-email</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> \ No newline at end of file Modified: trunk/helper-maven-plugin/src/test/resources/org/nuiton/helper/plugin/sendEmailMojoTest/skipSendEmail.xml =================================================================== --- trunk/src/test/resources/org/nuiton/helper/plugin/sendEmailMojoTest/skipSendEmail.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin/src/test/resources/org/nuiton/helper/plugin/sendEmailMojoTest/skipSendEmail.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,12 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: Mojos $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -28,31 +27,33 @@ 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>test-send-email</artifactId> - <version>0</version> - - <build> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.test</groupId> + <artifactId>test-send-email</artifactId> + <version>0</version> - <plugins> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>helper-maven-plugin</artifactId> - <configuration> - <emailContentFile>target/test-classes/org/nuiton/smail/plugin/sendEmailMojoTest/mailContentFile.txt</emailContentFile> - <emailTitle>[ANNOUNCEMENT] - One 1.0.0 released</emailTitle> - <encoding>UTF-8</encoding> - <skipSendEmail>true</skipSendEmail> - </configuration> - <executions> - <execution> - <goals> - <goal>send-email</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>helper-maven-plugin</artifactId> + <configuration> + <emailContentFile> + target/test-classes/org/nuiton/smail/plugin/sendEmailMojoTest/mailContentFile.txt + </emailContentFile> + <emailTitle>[ANNOUNCEMENT] - One 1.0.0 released</emailTitle> + <encoding>UTF-8</encoding> + <skipSendEmail>true</skipSendEmail> + </configuration> + <executions> + <execution> + <goals> + <goal>send-email</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> \ No newline at end of file Property changes on: trunk/helper-maven-plugin-api/LICENSE.txt ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Property changes on: trunk/helper-maven-plugin-api/README.txt ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Property changes on: trunk/helper-maven-plugin-api/changelog.txt ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/helper-maven-plugin-api/pom.xml =================================================================== --- trunk/helper-maven-plugin-api/pom.xml 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/helper-maven-plugin-api/pom.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Helper Maven plugin + Helper Maven plugin :: API %% - Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + Copyright (C) 2009 - 2012 Tony Chemit, 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 @@ -20,7 +20,9 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. #L% --> -<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"> +<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> @@ -58,30 +60,13 @@ </dependency> <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - </dependency> - - <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <exclusions> - <exclusion> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> <groupId>org.apache.maven.shared</groupId> <artifactId>maven-dependency-tree</artifactId> - <version>1.2</version> </dependency> <!-- plexus --> @@ -89,14 +74,9 @@ <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId> - <version>1.5.15</version> </dependency> - <dependency> - <groupId>org.sonatype.plexus</groupId> - <artifactId>plexus-sec-dispatcher</artifactId> - <version>1.4</version> - </dependency> + <!-- provided dependencies --> <dependency> <groupId>org.codehaus.plexus</groupId> @@ -106,20 +86,6 @@ </dependency> <dependency> - <groupId>plexus</groupId> - <artifactId>plexus-mail-sender-api</artifactId> - <version>${plexusMailSenderVersion}</version> - <exclusions> - <exclusion> - <groupId>plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </exclusion> - </exclusions> - </dependency> - - <!-- provided dependencies --> - - <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-project</artifactId> <version>${mavenVersion}</version> @@ -161,25 +127,9 @@ <scope>provided</scope> </dependency> - <!-- dependencies to mojo annotations --> <dependency> - <groupId>org.apache.maven.plugin-tools</groupId> - <artifactId>maven-plugin-annotations</artifactId> - <version>${pluginPluginVersion}</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> - <version>1.4.4</version> - </dependency> - - <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-provider-api</artifactId> - <version>1.0</version> - <scope>provided</scope> </dependency> <!-- tests dependencies --> @@ -187,7 +137,6 @@ <dependency> <groupId>org.apache.maven.plugin-testing</groupId> <artifactId>maven-plugin-testing-harness</artifactId> - <version>1.2</version> <scope>test</scope> <exclusions> @@ -233,7 +182,6 @@ <dependency> <groupId>velocity</groupId> <artifactId>velocity</artifactId> - <version>1.5</version> </dependency> </dependencies> @@ -295,12 +243,14 @@ <reportSets> <reportSet> <reports> + <report>index</report> <report>project-team</report> <report>mailing-list</report> <report>cim</report> <report>issue-tracking</report> <report>license</report> <report>scm</report> + <report>dependency-info</report> <report>dependencies</report> <report>dependency-convergence</report> <report>plugin-management</report> Property changes on: trunk/helper-maven-plugin-api/pom.xml ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Added: trunk/helper-maven-plugin-api/src/license/THIRD-PARTY.properties =================================================================== --- trunk/helper-maven-plugin-api/src/license/THIRD-PARTY.properties (rev 0) +++ trunk/helper-maven-plugin-api/src/license/THIRD-PARTY.properties 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,28 @@ +# Generated by org.codehaus.mojo.license.AddThirdPartyMojo +#------------------------------------------------------------------------------- +# Already used licenses in project : +# - Apache License +# - Apache Public License 2.0 +# - BSD License +# - BSD style +# - CDDL +# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 +# - Common Public License Version 1.0 +# - GPLv2+CE +# - Indiana University Extreme! Lab Software License, vesion 1.1.1 +# - Lesser General Public License (LPGL) +# - Lesser General Public License (LPGL) v 2.1 +# - MIT License +# - Public Domain +# - The Apache Software License, Version 2.0 +#------------------------------------------------------------------------------- +# Please fill the missing licenses for dependencies : +# +# +#Sun Nov 11 08:56:07 CET 2012 +classworlds--classworlds--1.1-alpha-2=http\://classworlds.codehaus.org/license.html +commons-cli--commons-cli--1.0=The Apache Software License, Version 2.0 +org.codehaus.plexus--plexus-container-default--1.0-alpha-9-stable-1=The Apache Software License, Version 2.0 +org.codehaus.plexus--plexus-interactivity-api--1.0-alpha-4=The Apache Software License, Version 2.0 +oro--oro--2.0.8=The Apache Software License, Version 2.0 +plexus--plexus-mail-sender-api--1.0-alpha-2=The Apache Software License, Version 2.0 Property changes on: trunk/helper-maven-plugin-api/src/license/THIRD-PARTY.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/FileUpdater.java (from rev 872, trunk/src/main/java/org/nuiton/io/FileUpdater.java) =================================================================== --- trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/FileUpdater.java (rev 0) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/FileUpdater.java 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,44 @@ +package org.nuiton.io; + +/* + * #%L + * Helper Maven Plugin :: API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit + * %% + * 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>. + * #L% + */ + +import java.io.File; + +/** + * Contract to be realized to test if a file is up to date. + * <p/> + * use {@link #isFileUpToDate(File)} to determine if a file is up to date. + * + * @author tchemit <chemit@codelutin.com> + */ +public interface FileUpdater { + + /** + * @param f file to test + * @return {@code true} if file is up to date, {@code false} otherwise. + */ + boolean isFileUpToDate(File f); + +} Copied: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/FileUpdaterHelper.java (from rev 872, trunk/src/main/java/org/nuiton/io/FileUpdaterHelper.java) =================================================================== --- trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/FileUpdaterHelper.java (rev 0) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/FileUpdaterHelper.java 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,94 @@ +package org.nuiton.io; + +/* + * #%L + * Helper Maven Plugin :: API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit + * %% + * 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>. + * #L% + */ + +import java.io.File; + +/** @author tchemit <chemit@codelutin.com> */ +public class FileUpdaterHelper { + + static public MirroredFileUpdater newJavaFileUpdater() { + return newJavaFileUpdater(null, null); + } + + static public MirroredFileUpdater newJaxxFileUpdater() { + return newJaxxFileUpdater(null, null); + } + + static public MirroredFileUpdater newJavaFileUpdater(File src, File dst) { + return new JavaFileUpdater(src, dst); + } + + static public MirroredFileUpdater newJaxxFileUpdater(File src, File dst) { + return new JaxxFileUpdater(src, dst); + } + + /** + * To test if a java source file is newser than his compiled class + * + * @author tchemit <chemit@codelutin.com> + */ + public static class JavaFileUpdater extends MirroredFileUpdater { + + protected JavaFileUpdater(File sourceDirectory, + File destinationDirectory) { + super(".java", ".class", sourceDirectory, destinationDirectory); + } + + @Override + public File getMirrorFile(File f) { + String file = + f.getAbsolutePath().substring(prefixSourceDirecotory); + String mirrorRelativePath = + file.substring(0, file.length() - 4) + "class"; + return new File(destinationDirectory + File.separator + + mirrorRelativePath); + } + } + + /** + * To test if a jaxx source file is newser than his generated java + * source file. + * + * @author tchemit <chemit@codelutin.com> + */ + public static class JaxxFileUpdater extends MirroredFileUpdater { + + protected JaxxFileUpdater(File sourceDirectory, + File destinationDirectory) { + super(".jaxx", ".java", sourceDirectory, destinationDirectory); + } + + @Override + public File getMirrorFile(File f) { + String file = + f.getAbsolutePath().substring(prefixSourceDirecotory); + String mirrorRelativePath = + file.substring(0, file.length() - 4) + "java"; + return new File(destinationDirectory + File.separator + + mirrorRelativePath); + } + } +} Copied: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/MirroredFileUpdater.java (from rev 872, trunk/src/main/java/org/nuiton/io/MirroredFileUpdater.java) =================================================================== --- trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/MirroredFileUpdater.java (rev 0) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/MirroredFileUpdater.java 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,130 @@ +package org.nuiton.io; + +/* + * #%L + * Helper Maven Plugin :: API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit + * %% + * 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>. + * #L% + */ + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.File; + +/** + * Simple base implementation of a {@link FileUpdater} for an updater with + * a sourcedir and a destinationdir. + * + * @author tchemit <chemit@codelutin.com> + */ +public class MirroredFileUpdater implements FileUpdater { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private final Log log = LogFactory.getLog(MirroredFileUpdater.class); + + /** source basedir */ + protected File sourceDirectory; + + /** length of source basedir absolute path */ + protected int prefixSourceDirecotory; + + /** destination basedir */ + protected File destinationDirectory; + + protected String fileInPattern = ""; + + protected String fileOutPattern = ""; + + public MirroredFileUpdater(String fileInPattern, + String fileOutPattern, + File sourceDirectory, + File destinationDirectory) { + this.fileInPattern = fileInPattern; + this.fileOutPattern = fileOutPattern; + this.sourceDirectory = sourceDirectory; + this.destinationDirectory = destinationDirectory; + if (sourceDirectory != null) { + prefixSourceDirecotory = sourceDirectory.getAbsolutePath().length(); + } + if (log.isDebugEnabled()) { + log.debug(this); + } + } + + public File getSourceDirectory() { + return sourceDirectory; + } + + public File getDestinationDirectory() { + return destinationDirectory; + } + + public String getFileInPattern() { + return fileInPattern; + } + + public String getFileOutPattern() { + return fileOutPattern; + } + + public File getMirrorFile(File f) { + String filename = f.getName(); + String file = f.getAbsolutePath().substring(prefixSourceDirecotory); + file = file.substring(0, file.length() - filename.length()); + String destFilename = applyTransformationFilename(filename); + String mirrorRelativePath = file + destFilename; + return new File(destinationDirectory + File.separator + + mirrorRelativePath); + } + + @Override + public boolean isFileUpToDate(File f) { + File mirror = getMirrorFile(f); + return mirror.exists() && f.lastModified() < mirror.lastModified(); + } + + public void setDestinationDirectory(File destinationDirectory) { + this.destinationDirectory = destinationDirectory; + } + + public void setSourceDirectory(File sourceDirectory) { + this.sourceDirectory = sourceDirectory; + prefixSourceDirecotory = sourceDirectory.getAbsolutePath().length(); + } + + public void setFileInPattern(String fileInPattern) { + this.fileInPattern = fileInPattern; + } + + public void setFileOutPattern(String fileOutPattern) { + this.fileOutPattern = fileOutPattern; + } + + public String applyTransformationFilename(String filename) { + return filename.replaceAll(fileInPattern, fileOutPattern); + } + + @Override + public String toString() { + return super.toString() + "<srcdir:" + sourceDirectory + + ", destdir:" + destinationDirectory + ">"; + } +} Copied: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/PropertiesDateRemoveFilterStream.java (from rev 872, trunk/src/main/java/org/nuiton/io/PropertiesDateRemoveFilterStream.java) =================================================================== --- trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/PropertiesDateRemoveFilterStream.java (rev 0) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/PropertiesDateRemoveFilterStream.java 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,65 @@ +package org.nuiton.io; + +/* + * #%L + * Helper Maven Plugin :: API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit + * %% + * 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>. + * #L% + */ + +import java.io.FilterOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +/** + * Un ecrivain qui supprime la premiere ligne rencontree dans le flux. + * + * + * <b>Note: </b> Attention, les performance d'utilisation de cet ecrivain + * est problèmatique, car sur de gros fichiers (>1000 entrees) les + * performances se degradent serieusement : pour 1200 entrees on arrive à + * plus de 5 secondes, alors que sans on a 76 ms! ... + * + * FIXME : implanter quelque chose de plus performant dans tous les cas + */ +public class PropertiesDateRemoveFilterStream extends FilterOutputStream { + + private boolean firstLineOver; + char endChar; + + public PropertiesDateRemoveFilterStream(OutputStream out) { + super(out); + firstLineOver = false; + String lineSeparator = System.getProperty("line.separator"); + endChar = lineSeparator.charAt(lineSeparator.length() - 1); + } + + @Override + public void write(int b) throws IOException { + if (!firstLineOver) { + char c = (char) b; + if (c == endChar) { + firstLineOver = true; + } + } else { + out.write(b); + } + } +} Copied: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/SortedProperties.java (from rev 872, trunk/src/main/java/org/nuiton/io/SortedProperties.java) =================================================================== --- trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/SortedProperties.java (rev 0) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/SortedProperties.java 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,437 @@ +package org.nuiton.io; + +/* + * #%L + * Helper Maven Plugin :: API + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit + * %% + * 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>. + * #L% + */ + +import org.nuiton.plugin.PluginHelper; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; +import java.util.Collections; +import java.util.Date; +import java.util.Enumeration; +import java.util.List; +import java.util.Properties; +import java.util.Vector; + +/** + * Extend {@link Properties} to allow alphabetical order. Encoding could also + * be defined but you must use this class only with Java 1.6. + * + * @author ruchaud <ruchaud@codelutin.com> + * @author tchemit <chemit@codelutin.com> + */ +public class SortedProperties extends Properties { + + private static final long serialVersionUID = -1147150444452577558L; + + public static final String ENCODING_DEFAULT = "8859_1"; + + public static final String ENCODING_LATIN1 = "iso-8859-1"; + + public static final String ENCODING_ASCII = "us-ascii"; + + /** A table of hex digits in upper case */ + private static final char[] hexDigitUpper = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' + }; + + /** A table of hex digits in lower case */ + private static final char[] hexDigitLower = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' + }; + + /** l'encoding par defaut a utiliser pour lire et ecrire le properties. */ + protected String defaultEncoding; + + /** un drapeau pour savoir s'il faut enlever l'entete generere */ + protected boolean removeHeader; + + /** + * A flag to write unicode using the a lower letter. + * <p/> + * Example : {@code \u00e9} instead of {@code \u00E9}. + */ + final protected boolean unicodeLower; + + final protected char[] hexDigit; + + public SortedProperties() { + this(ENCODING_DEFAULT); + } + + public SortedProperties(String defaultEncoding) { + this(defaultEncoding, true, false); + } + + public SortedProperties(String defaultEncoding, boolean removeHeader) { + this(defaultEncoding, removeHeader, false); + } + + public SortedProperties(String defaultEncoding, boolean removeHeader, boolean unicodeLower) { + this.defaultEncoding = defaultEncoding; + this.removeHeader = removeHeader; + this.unicodeLower = unicodeLower; + hexDigit = unicodeLower ? hexDigitLower : hexDigitUpper; + } + + public SortedProperties(Properties defaults) { + super(defaults); + defaultEncoding = ENCODING_DEFAULT; + unicodeLower = false; + hexDigit = hexDigitUpper; + } + + @Override + public Enumeration<Object> keys() { + List<Object> objects = Collections.list(super.keys()); + Vector<Object> result; + try { + // Attention, si les clef ne sont pas des string, ca ne marchera pas + List<String> list = + PluginHelper.toGenericList(objects, String.class); + Collections.sort(list); + result = new Vector<Object>(list); + } catch (IllegalArgumentException e) { + // keys are not string !!! + // can not sort keys + result = new Vector<Object>(objects); + } + return result.elements(); + } + + /** + * Load all properties from given {@code src} file using defined {@code defaultEncoding}. + * + * @param src source file + * @return this instance + * @throws IOException if any io pb + * @see #load(File, String) + */ + public SortedProperties load(File src) throws IOException { + return load(src, defaultEncoding); + } + + /** + * Load Properties from {@code src} file using given {@code defaultEncoding}. + * If this {@code encoding} is different from default ones + * {@link #ENCODING_DEFAULT}, {@link #ENCODING_LATIN1} + * and {@link #ENCODING_ASCII}. A specific {@link Reader} will + * be used to read the file. + * + * @param src File where Properties will be loaded + * @param encoding Encoding to use + * @throws IOException for any file errors + * @since 1.3 + * @return this instance + */ + public SortedProperties load(File src, String encoding) throws IOException { + Reader reader = new InputStreamReader(new FileInputStream(src), encoding); + try { + load(reader); + } finally { + reader.close(); + } + return this; + } + + /** + * Save properties in given {@code dst} file using defined {@code defaultEncoding}. + * + * @param dst output file + * @throws IOException if any io pb + * @see #store(File, String) + */ + public void store(File dst) throws IOException { + store(dst, defaultEncoding); + } + + /** + * Store Properties in {@code output} file using given {@code defaultEncoding}. + * If this {@code encoding} is different from default ones + * {@link #ENCODING_DEFAULT}, {@link #ENCODING_LATIN1} + * and {@link #ENCODING_ASCII}, a specific {@link Writer} will + * be used to save the file. Otherwise the default Properties behavior + * will escape unicode chars with <code>\u</code><i>xxxx</i>. + * + * @param dst File to save Properties + * @param encoding Encoding to use + * @throws IOException for any file errors + * @since 1.3 + */ + public void store(File dst, String encoding) throws IOException { + OutputStream stream = new FileOutputStream(dst); + try { + storeEncode(stream, encoding); + } finally { + stream.close(); + } + } + + /** + * If encoding is not the default Properties one, we will use a writer + * to use this custom encoding. + * <p/> + * We must call the right method depends on encoding, for a custom one + * the {@link #store(Writer, String)} method is used otherwise the + * default encoding 8859_1 must be used as superclass define it in + * {@link #store(OutputStream, String)}. + * <p/> + * Encoding {@link #ENCODING_DEFAULT}, + * {@link #ENCODING_LATIN1} and {@link #ENCODING_ASCII} + * are considered as default Properties one, so the old method will be use + * escaping unicode chars like <code>\u</code><i>xxxx</i>. + * + * @param stream OutputStream to save in + * @param encoding Encoding to use + * @throws IOException For any file errors + */ + protected void storeEncode(OutputStream stream, String encoding) throws IOException { + + // Specific encoding different from default ones + if (!ENCODING_LATIN1.equalsIgnoreCase(encoding) && + !ENCODING_DEFAULT.equals(encoding) && + !ENCODING_ASCII.equalsIgnoreCase(encoding)) { + + Writer writer = new OutputStreamWriter(stream, encoding); + try { + store(writer, null); + } finally { + writer.close(); + } + + } else { + + store(stream, null); + } + } + + /** + * Save properties in given {@code stream} file. {@code defaultEncoding} defined + * will be ignored to store the properties file. The default encoding is the + * basic Properties one (Latin1 ISO), unicode chars will be escaped + * like basic {@link #store(OutputStream, String)} method. + * + * @param dst output file + * @throws IOException if any io pb + */ + public void store(OutputStream dst) throws IOException { + store(dst, null); + } + + @Override + public void store(OutputStream out, String comments) + throws IOException { + + // Keep same implementation as super Properties class. Even if the + // encoding is modified, the resulting file always be an ASCII one + // because of escUnicode flag in store0 method. This method is overriden + // because of custom store0 method that can removeHeader. + + BufferedWriter writer = new BufferedWriter( + new OutputStreamWriter(out, "8859_1")); + try { + store0(writer, comments, true); + } finally { + writer.close(); + } + } + + @Override + public void store(Writer writer, String comments) throws IOException { + + // Keep same implementation as super Properties class. This method + // is overriden because of custom store0 method that can removeHeader. + + BufferedWriter bufferedWriter; + if (writer instanceof BufferedWriter) { + bufferedWriter = (BufferedWriter) writer; + } else { + bufferedWriter = new BufferedWriter(writer); + } + try { + store0(bufferedWriter, comments, false); + } finally { + writer.close(); + } + } + + protected void store0(BufferedWriter bw, String comments, boolean escUnicode) + throws IOException { + if (comments != null) { + writeComments(bw, comments); + } + + // Here is the modification wanted + if (!removeHeader) { + bw.write("#" + new Date().toString()); + bw.newLine(); + } + + synchronized (this) { + for (Enumeration e = keys(); e.hasMoreElements();) { + String key = (String) e.nextElement(); + String val = (String) get(key); + key = saveConvert(key, true, escUnicode); + /* No need to escape embedded and trailing spaces for value, hence + * pass false to flag. + */ + val = saveConvert(val, false, escUnicode); + bw.write(key + "=" + val); + bw.newLine(); + } + } + bw.flush(); + } + + // --- Copy implementations from Properties superClass, the store0 method + // is overriden and all method calls are private, so we copy the code here. + + protected String saveConvert(String theString, + boolean escapeSpace, + boolean escapeUnicode) { + int len = theString.length(); + int bufLen = len * 2; + if (bufLen < 0) { + bufLen = Integer.MAX_VALUE; + } + StringBuffer outBuffer = new StringBuffer(bufLen); + + for (int x = 0; x < len; x++) { + char aChar = theString.charAt(x); + // Handle common case first, selecting largest block that + // avoids the specials below + if ((aChar > 61) && (aChar < 127)) { + if (aChar == '\\') { + outBuffer.append('\\'); + outBuffer.append('\\'); + continue; + } + outBuffer.append(aChar); + continue; + } + switch (aChar) { + case ' ': + if (x == 0 || escapeSpace) + outBuffer.append('\\'); + outBuffer.append(' '); + break; + case '\t': + outBuffer.append('\\'); + outBuffer.append('t'); + break; + case '\n': + outBuffer.append('\\'); + outBuffer.append('n'); + break; + case '\r': + outBuffer.append('\\'); + outBuffer.append('r'); + break; + case '\f': + outBuffer.append('\\'); + outBuffer.append('f'); + break; + case '=': // Fall through + case ':': // Fall through + case '#': // Fall through + case '!': + outBuffer.append('\\'); + outBuffer.append(aChar); + break; + default: + if (((aChar < 0x0020) || (aChar > 0x007e)) & escapeUnicode) { + outBuffer.append('\\'); + outBuffer.append('u'); + outBuffer.append(toHex((aChar >> 12) & 0xF)); + outBuffer.append(toHex((aChar >> 8) & 0xF)); + outBuffer.append(toHex((aChar >> 4) & 0xF)); + outBuffer.append(toHex(aChar & 0xF)); + } else { + outBuffer.append(aChar); + } + } + } + return outBuffer.toString(); + } + + public void writeComments(BufferedWriter bw, String comments) + throws IOException { + bw.write("#"); + int len = comments.length(); + int current = 0; + int last = 0; + char[] uu = new char[6]; + uu[0] = '\\'; + uu[1] = 'u'; + while (current < len) { + char c = comments.charAt(current); + if (c > '\u00ff' || c == '\n' || c == '\r') { + if (last != current) + bw.write(comments.substring(last, current)); + if (c > '\u00ff') { + uu[2] = toHex((c >> 12) & 0xf); + uu[3] = toHex((c >> 8) & 0xf); + uu[4] = toHex((c >> 4) & 0xf); + uu[5] = toHex(c & 0xf); + bw.write(new String(uu)); + } else { + bw.newLine(); + if (c == '\r' && + current != len - 1 && + comments.charAt(current + 1) == '\n') { + current++; + } + if (current == len - 1 || + (comments.charAt(current + 1) != '#' && + comments.charAt(current + 1) != '!')) + bw.write("#"); + } + last = current + 1; + } + current++; + } + if (last != current) + bw.write(comments.substring(last, current)); + bw.newLine(); + } + + /** + * Convert a nibble to a hex character + * + * @param nibble the nibble to convert. + */ + protected char toHex(int nibble) { + return hexDigit[(nibble & 0xF)]; + } + +} Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/AbstractXpp3Reader.java =================================================================== --- trunk/src/main/java/org/nuiton/io/xpp3/AbstractXpp3Reader.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/AbstractXpp3Reader.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.io.xpp3; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.io.xpp3; - import com.google.common.collect.Sets; import org.codehaus.plexus.util.xml.pull.MXParser; import org.codehaus.plexus.util.xml.pull.XmlPullParser; Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/AttributeValueToProperty.java =================================================================== --- trunk/src/main/java/org/nuiton/io/xpp3/AttributeValueToProperty.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/AttributeValueToProperty.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.io.xpp3; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2012 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -22,7 +23,6 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ -package org.nuiton.io.xpp3; import org.codehaus.plexus.util.xml.pull.XmlPullParser; Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/DataConverter.java =================================================================== --- trunk/src/main/java/org/nuiton/io/xpp3/DataConverter.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/DataConverter.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.io.xpp3; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.io.xpp3; - /** * A contract to a data converter from a text value to a typed value. * <p/> Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/DefaultDataConverter.java =================================================================== --- trunk/src/main/java/org/nuiton/io/xpp3/DefaultDataConverter.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/DefaultDataConverter.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.io.xpp3; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.io.xpp3; - /** * A enumaration to convert some data from a string representation. * <p/> Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/PropertyMapper.java =================================================================== --- trunk/src/main/java/org/nuiton/io/xpp3/PropertyMapper.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/PropertyMapper.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.io.xpp3; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.io.xpp3; - import com.google.common.base.Function; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.ToStringBuilder; Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/TagContentToProperty.java =================================================================== --- trunk/src/main/java/org/nuiton/io/xpp3/TagContentToProperty.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/TagContentToProperty.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.io.xpp3; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2012 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -22,7 +23,6 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ -package org.nuiton.io.xpp3; import org.codehaus.plexus.util.xml.pull.XmlPullParser; Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/TagTextContentToProperty.java =================================================================== --- trunk/src/main/java/org/nuiton/io/xpp3/TagTextContentToProperty.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/TagTextContentToProperty.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.io.xpp3; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2012 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -22,7 +23,6 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ -package org.nuiton.io.xpp3; import org.codehaus.plexus.util.xml.pull.XmlPullParser; Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/Xpp3Helper.java =================================================================== --- trunk/src/main/java/org/nuiton/io/xpp3/Xpp3Helper.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/Xpp3Helper.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.io.xpp3; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.io.xpp3; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.codehaus.plexus.util.IOUtil; Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/Xpp3Reader.java =================================================================== --- trunk/src/main/java/org/nuiton/io/xpp3/Xpp3Reader.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/io/xpp3/Xpp3Reader.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.io.xpp3; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.io.xpp3; - import org.codehaus.plexus.util.xml.pull.XmlPullParser; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/AbstractAvailableDataMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/plugin/AbstractAvailableDataMojo.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/AbstractAvailableDataMojo.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2011 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -22,7 +23,6 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ -package org.nuiton.plugin; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/AbstractPlugin.java =================================================================== --- trunk/src/main/java/org/nuiton/plugin/AbstractPlugin.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/AbstractPlugin.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.plugin; - import org.apache.maven.artifact.Artifact; import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/DependencyUtil.java =================================================================== --- trunk/src/main/java/org/nuiton/plugin/DependencyUtil.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/DependencyUtil.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.plugin; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.maven.artifact.Artifact; Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/Plugin.java =================================================================== --- trunk/src/main/java/org/nuiton/plugin/Plugin.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/Plugin.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.plugin; - import org.apache.maven.plugin.Mojo; import org.apache.maven.project.MavenProject; Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/PluginHelper.java =================================================================== --- trunk/src/main/java/org/nuiton/plugin/PluginHelper.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/PluginHelper.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.plugin; - import org.apache.maven.model.Resource; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.DirectoryScanner; Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/PluginIOContext.java =================================================================== --- trunk/src/main/java/org/nuiton/plugin/PluginIOContext.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/PluginIOContext.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.plugin; - import java.io.File; /** Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/PluginWithEncoding.java =================================================================== --- trunk/src/main/java/org/nuiton/plugin/PluginWithEncoding.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/PluginWithEncoding.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.plugin; - /** * A common contract to be implements by our mojo and reports which needs encoding. * <p/> Modified: trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/VelocityTemplateGenerator.java =================================================================== --- trunk/src/main/java/org/nuiton/plugin/VelocityTemplateGenerator.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/java/org/nuiton/plugin/VelocityTemplateGenerator.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.plugin; - import org.apache.maven.project.MavenProject; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; Modified: trunk/helper-maven-plugin-api/src/main/resources/assemblies/deps.xml =================================================================== --- trunk/src/main/resources/assemblies/deps.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/resources/assemblies/deps.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: API $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin-api/src/main/resources/assemblies/full.xml =================================================================== --- trunk/src/main/resources/assemblies/full.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/main/resources/assemblies/full.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: API $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Copied: trunk/helper-maven-plugin-api/src/site/apt/mojo-framework.apt (from rev 872, trunk/src/site/apt/mojo-framework.apt) =================================================================== --- trunk/helper-maven-plugin-api/src/site/apt/mojo-framework.apt (rev 0) +++ trunk/helper-maven-plugin-api/src/site/apt/mojo-framework.apt 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,70 @@ +~~~ +~~ #%L +~~ Helper Maven Plugin :: API +~~ $Id$ +~~ $HeadURL$ +~~ %% +~~ Copyright (C) 2009 - 2012 Codelutin, Tony Chemit +~~ %% +~~ 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>. +~~ #L% +~~~ +---- +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>> implements 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, throw an error if any problem. + + * <<checkSkip>> to test if can skip mojo execution (since 1.2.0) + + The core method is the <<doAction>> one, put there your logic. + + Note: since version 1.2.0 the <<doAction>> method will only be executed if the + mojo must be executed. you should no more do some tests here to know if the + mojo can be skip. + + +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/helper-maven-plugin-api/src/site/apt/mojo-framework.apt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:mergeinfo + Added: svn:eol-style + native Copied: trunk/helper-maven-plugin-api/src/site/apt/mojo-testFramework.apt (from rev 872, trunk/src/site/apt/mojo-testFramework.apt) =================================================================== --- trunk/helper-maven-plugin-api/src/site/apt/mojo-testFramework.apt (rev 0) +++ trunk/helper-maven-plugin-api/src/site/apt/mojo-testFramework.apt 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,200 @@ +~~~ +~~ #%L +~~ Helper Maven Plugin :: API +~~ $Id$ +~~ $HeadURL$ +~~ %% +~~ Copyright (C) 2009 - 2012 Codelutin, Tony Chemit +~~ %% +~~ 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>. +~~ #L% +~~~ +---- +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>> implements 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/helper-maven-plugin-api/src/site/apt/mojo-testFramework.apt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:mergeinfo + Added: svn:eol-style + native Copied: trunk/helper-maven-plugin-api/src/site/site_en.xml (from rev 872, trunk/src/site/site_en.xml) =================================================================== --- trunk/helper-maven-plugin-api/src/site/site_en.xml (rev 0) +++ trunk/helper-maven-plugin-api/src/site/site_en.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Helper Maven Plugin :: API + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit + %% + 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>. + #L% + --> + +<project name="${project.name}"> + + <bannerLeft> + <name>${project.name}</name> + <href>index.html</href> + </bannerLeft> + + <body> + + <header> + <script type="text/javascript" + src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js"> + </script> + </header> + + <breadcrumbs> + <item name="${project.name}" href="index.html"/> + </breadcrumbs> + + <menu name="User"> + <item name="Introduction" href="index.html"/> + </menu> + + <menu name="Developer"> + <item name="Mojo framework" href="mojo-framework.html"/> + <item name="Mojo test framework" href="mojo-testFramework.html"/> + </menu> + + <menu ref="reports"/> + + <footer> + + <div id='projectMetas' + projectversion='${project.version}' + platform='${project.platform}' + projectid='${project.projectId}' + scm='${project.scm.developerConnection}' + scmwebeditorenabled='${project.scmwebeditorEnabled}' + scmwebeditorurl='${project.scmwebeditorUrl}' + siteSourcesType='${project.siteSourcesType}' + piwikEnabled='${project.piwikEnabled}' + piwikId='${project.piwikId}'> + </div> + </footer> + + </body> +</project> Modified: trunk/helper-maven-plugin-api/src/test/java/org/nuiton/plugin/AbstractMojoTest.java =================================================================== --- trunk/src/test/java/org/nuiton/plugin/AbstractMojoTest.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/test/java/org/nuiton/plugin/AbstractMojoTest.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.plugin; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.maven.plugin.Mojo; Modified: trunk/helper-maven-plugin-api/src/test/java/org/nuiton/plugin/PluginHelperTest.java =================================================================== --- trunk/src/test/java/org/nuiton/plugin/PluginHelperTest.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/test/java/org/nuiton/plugin/PluginHelperTest.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.plugin; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assert; Modified: trunk/helper-maven-plugin-api/src/test/java/org/nuiton/plugin/TestHelper.java =================================================================== --- trunk/src/test/java/org/nuiton/plugin/TestHelper.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/test/java/org/nuiton/plugin/TestHelper.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.plugin; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -23,8 +24,6 @@ * #L% */ -package org.nuiton.plugin; - import org.apache.maven.plugin.Mojo; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.codehaus.plexus.PlexusContainer; Copied: trunk/helper-maven-plugin-api/src/test/resources/log4j.properties (from rev 872, trunk/src/test/resources/log4j.properties) =================================================================== --- trunk/helper-maven-plugin-api/src/test/resources/log4j.properties (rev 0) +++ trunk/helper-maven-plugin-api/src/test/resources/log4j.properties 2012-11-11 08:14:19 UTC (rev 876) @@ -0,0 +1,34 @@ +### +# #%L +# Helper Maven Plugin :: API +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2009 - 2012 Codelutin, Tony Chemit +# %% +# 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>. +# #L% +### +# Global logging configuration +log4j.rootLogger=ERROR, stdout +# Console output... +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=[%p] (%F:%L) %M - %m%n +#log4j.appender.stdout.layout.ConversionPattern=[%p] [%t] (%F:%L) %M - %m%n + +# package level +log4j.logger.org.nuiton=INFO + Property changes on: trunk/helper-maven-plugin-api/src/test/resources/log4j.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/JaxxDummy.java =================================================================== --- trunk/src/test/resources/org/nuiton/io/JaxxDummy.java 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/JaxxDummy.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,12 @@ +package org.nuiton.io; + /* * #%L - * Maven helper plugin - * + * Helper Maven Plugin :: API * $Id$ * $HeadURL$ * %% - * Copyright (C) 2009 - 2010 CodeLutin + * Copyright (C) 2009 - 2012 Codelutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -22,7 +23,6 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ -package org.nuiton.io; /** @author tchemit <chemit@codelutin.com> */ public class JaxxDummy { Modified: trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/JaxxDummy.jaxx =================================================================== --- trunk/src/test/resources/org/nuiton/io/JaxxDummy.jaxx 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/JaxxDummy.jaxx 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: API $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/xpp3/identities.xml =================================================================== --- trunk/src/test/resources/org/nuiton/io/xpp3/identities.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/xpp3/identities.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: API $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/xpp3/identities2.xml =================================================================== --- trunk/src/test/resources/org/nuiton/io/xpp3/identities2.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/xpp3/identities2.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: API $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/xpp3/identity.xml =================================================================== --- trunk/src/test/resources/org/nuiton/io/xpp3/identity.xml 2012-10-30 07:43:59 UTC (rev 872) +++ trunk/helper-maven-plugin-api/src/test/resources/org/nuiton/io/xpp3/identity.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,11 +1,10 @@ <!-- #%L - Maven helper plugin - + Helper Maven Plugin :: API $Id$ $HeadURL$ %% - Copyright (C) 2009 - 2010 CodeLutin + Copyright (C) 2009 - 2012 Codelutin, Tony Chemit %% This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/pom.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Helper Maven plugin + Helper Maven plugin :: Parent %% - Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + Copyright (C) 2009 - 2012 Tony Chemit, 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 @@ -104,6 +104,8 @@ <!-- documentation is in apt --> <siteSourcesType>apt</siteSourcesType> + <license.organizationName>Codelutin, Tony Chemit</license.organizationName> + </properties> <dependencyManagement> Deleted: trunk/src/main/java/org/nuiton/io/FileUpdater.java =================================================================== --- trunk/src/main/java/org/nuiton/io/FileUpdater.java 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/src/main/java/org/nuiton/io/FileUpdater.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,45 +0,0 @@ -/* - * #%L - * Maven helper plugin - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Tony Chemit, 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>. - * #L% - */ - -package org.nuiton.io; - -import java.io.File; - -/** - * Contract to be realized to test if a file is up to date. - * <p/> - * use {@link #isFileUpToDate(File)} to determine if a file is up to date. - * - * @author tchemit <chemit@codelutin.com> - */ -public interface FileUpdater { - - /** - * @param f file to test - * @return {@code true} if file is up to date, {@code false} otherwise. - */ - boolean isFileUpToDate(File f); - -} Deleted: trunk/src/main/java/org/nuiton/io/FileUpdaterHelper.java =================================================================== --- trunk/src/main/java/org/nuiton/io/FileUpdaterHelper.java 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/src/main/java/org/nuiton/io/FileUpdaterHelper.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,95 +0,0 @@ -/* - * #%L - * Maven helper plugin - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Tony Chemit, 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>. - * #L% - */ - -package org.nuiton.io; - -import java.io.File; - -/** @author tchemit <chemit@codelutin.com> */ -public class FileUpdaterHelper { - - static public MirroredFileUpdater newJavaFileUpdater() { - return newJavaFileUpdater(null, null); - } - - static public MirroredFileUpdater newJaxxFileUpdater() { - return newJaxxFileUpdater(null, null); - } - - static public MirroredFileUpdater newJavaFileUpdater(File src, File dst) { - return new JavaFileUpdater(src, dst); - } - - static public MirroredFileUpdater newJaxxFileUpdater(File src, File dst) { - return new JaxxFileUpdater(src, dst); - } - - /** - * To test if a java source file is newser than his compiled class - * - * @author tchemit <chemit@codelutin.com> - */ - public static class JavaFileUpdater extends MirroredFileUpdater { - - protected JavaFileUpdater(File sourceDirectory, - File destinationDirectory) { - super(".java", ".class", sourceDirectory, destinationDirectory); - } - - @Override - public File getMirrorFile(File f) { - String file = - f.getAbsolutePath().substring(prefixSourceDirecotory); - String mirrorRelativePath = - file.substring(0, file.length() - 4) + "class"; - return new File(destinationDirectory + File.separator + - mirrorRelativePath); - } - } - - /** - * To test if a jaxx source file is newser than his generated java - * source file. - * - * @author tchemit <chemit@codelutin.com> - */ - public static class JaxxFileUpdater extends MirroredFileUpdater { - - protected JaxxFileUpdater(File sourceDirectory, - File destinationDirectory) { - super(".jaxx", ".java", sourceDirectory, destinationDirectory); - } - - @Override - public File getMirrorFile(File f) { - String file = - f.getAbsolutePath().substring(prefixSourceDirecotory); - String mirrorRelativePath = - file.substring(0, file.length() - 4) + "java"; - return new File(destinationDirectory + File.separator + - mirrorRelativePath); - } - } -} Deleted: trunk/src/main/java/org/nuiton/io/MirroredFileUpdater.java =================================================================== --- trunk/src/main/java/org/nuiton/io/MirroredFileUpdater.java 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/src/main/java/org/nuiton/io/MirroredFileUpdater.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,131 +0,0 @@ -/* - * #%L - * Maven helper plugin - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Tony Chemit, 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>. - * #L% - */ - -package org.nuiton.io; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.io.File; - -/** - * Simple base implementation of a {@link FileUpdater} for an updater with - * a sourcedir and a destinationdir. - * - * @author tchemit <chemit@codelutin.com> - */ -public class MirroredFileUpdater implements FileUpdater { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(MirroredFileUpdater.class); - - /** source basedir */ - protected File sourceDirectory; - - /** length of source basedir absolute path */ - protected int prefixSourceDirecotory; - - /** destination basedir */ - protected File destinationDirectory; - - protected String fileInPattern = ""; - - protected String fileOutPattern = ""; - - public MirroredFileUpdater(String fileInPattern, - String fileOutPattern, - File sourceDirectory, - File destinationDirectory) { - this.fileInPattern = fileInPattern; - this.fileOutPattern = fileOutPattern; - this.sourceDirectory = sourceDirectory; - this.destinationDirectory = destinationDirectory; - if (sourceDirectory != null) { - prefixSourceDirecotory = sourceDirectory.getAbsolutePath().length(); - } - if (log.isDebugEnabled()) { - log.debug(this); - } - } - - public File getSourceDirectory() { - return sourceDirectory; - } - - public File getDestinationDirectory() { - return destinationDirectory; - } - - public String getFileInPattern() { - return fileInPattern; - } - - public String getFileOutPattern() { - return fileOutPattern; - } - - public File getMirrorFile(File f) { - String filename = f.getName(); - String file = f.getAbsolutePath().substring(prefixSourceDirecotory); - file = file.substring(0, file.length() - filename.length()); - String destFilename = applyTransformationFilename(filename); - String mirrorRelativePath = file + destFilename; - return new File(destinationDirectory + File.separator + - mirrorRelativePath); - } - - @Override - public boolean isFileUpToDate(File f) { - File mirror = getMirrorFile(f); - return mirror.exists() && f.lastModified() < mirror.lastModified(); - } - - public void setDestinationDirectory(File destinationDirectory) { - this.destinationDirectory = destinationDirectory; - } - - public void setSourceDirectory(File sourceDirectory) { - this.sourceDirectory = sourceDirectory; - prefixSourceDirecotory = sourceDirectory.getAbsolutePath().length(); - } - - public void setFileInPattern(String fileInPattern) { - this.fileInPattern = fileInPattern; - } - - public void setFileOutPattern(String fileOutPattern) { - this.fileOutPattern = fileOutPattern; - } - - public String applyTransformationFilename(String filename) { - return filename.replaceAll(fileInPattern, fileOutPattern); - } - - @Override - public String toString() { - return super.toString() + "<srcdir:" + sourceDirectory + - ", destdir:" + destinationDirectory + ">"; - } -} Deleted: trunk/src/main/java/org/nuiton/io/PropertiesDateRemoveFilterStream.java =================================================================== --- trunk/src/main/java/org/nuiton/io/PropertiesDateRemoveFilterStream.java 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/src/main/java/org/nuiton/io/PropertiesDateRemoveFilterStream.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,66 +0,0 @@ -/* - * #%L - * Maven helper plugin - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Tony Chemit, 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>. - * #L% - */ - -package org.nuiton.io; - -import java.io.FilterOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -/** - * Un ecrivain qui supprime la premiere ligne rencontree dans le flux. - * - * - * <b>Note: </b> Attention, les performance d'utilisation de cet ecrivain - * est problèmatique, car sur de gros fichiers (>1000 entrees) les - * performances se degradent serieusement : pour 1200 entrees on arrive à - * plus de 5 secondes, alors que sans on a 76 ms! ... - * - * FIXME : implanter quelque chose de plus performant dans tous les cas - */ -public class PropertiesDateRemoveFilterStream extends FilterOutputStream { - - private boolean firstLineOver; - char endChar; - - public PropertiesDateRemoveFilterStream(OutputStream out) { - super(out); - firstLineOver = false; - String lineSeparator = System.getProperty("line.separator"); - endChar = lineSeparator.charAt(lineSeparator.length() - 1); - } - - @Override - public void write(int b) throws IOException { - if (!firstLineOver) { - char c = (char) b; - if (c == endChar) { - firstLineOver = true; - } - } else { - out.write(b); - } - } -} Deleted: trunk/src/main/java/org/nuiton/io/SortedProperties.java =================================================================== --- trunk/src/main/java/org/nuiton/io/SortedProperties.java 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/src/main/java/org/nuiton/io/SortedProperties.java 2012-11-11 08:14:19 UTC (rev 876) @@ -1,438 +0,0 @@ -/* - * #%L - * Maven helper plugin - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Tony Chemit, 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>. - * #L% - */ - -package org.nuiton.io; - -import org.nuiton.plugin.PluginHelper; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Reader; -import java.io.Writer; -import java.util.Collections; -import java.util.Date; -import java.util.Enumeration; -import java.util.List; -import java.util.Properties; -import java.util.Vector; - -/** - * Extend {@link Properties} to allow alphabetical order. Encoding could also - * be defined but you must use this class only with Java 1.6. - * - * @author ruchaud <ruchaud@codelutin.com> - * @author tchemit <chemit@codelutin.com> - */ -public class SortedProperties extends Properties { - - private static final long serialVersionUID = -1147150444452577558L; - - public static final String ENCODING_DEFAULT = "8859_1"; - - public static final String ENCODING_LATIN1 = "iso-8859-1"; - - public static final String ENCODING_ASCII = "us-ascii"; - - /** A table of hex digits in upper case */ - private static final char[] hexDigitUpper = { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' - }; - - /** A table of hex digits in lower case */ - private static final char[] hexDigitLower = { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' - }; - - /** l'encoding par defaut a utiliser pour lire et ecrire le properties. */ - protected String defaultEncoding; - - /** un drapeau pour savoir s'il faut enlever l'entete generere */ - protected boolean removeHeader; - - /** - * A flag to write unicode using the a lower letter. - * <p/> - * Example : {@code \u00e9} instead of {@code \u00E9}. - */ - final protected boolean unicodeLower; - - final protected char[] hexDigit; - - public SortedProperties() { - this(ENCODING_DEFAULT); - } - - public SortedProperties(String defaultEncoding) { - this(defaultEncoding, true, false); - } - - public SortedProperties(String defaultEncoding, boolean removeHeader) { - this(defaultEncoding, removeHeader, false); - } - - public SortedProperties(String defaultEncoding, boolean removeHeader, boolean unicodeLower) { - this.defaultEncoding = defaultEncoding; - this.removeHeader = removeHeader; - this.unicodeLower = unicodeLower; - hexDigit = unicodeLower ? hexDigitLower : hexDigitUpper; - } - - public SortedProperties(Properties defaults) { - super(defaults); - defaultEncoding = ENCODING_DEFAULT; - unicodeLower = false; - hexDigit = hexDigitUpper; - } - - @Override - public Enumeration<Object> keys() { - List<Object> objects = Collections.list(super.keys()); - Vector<Object> result; - try { - // Attention, si les clef ne sont pas des string, ca ne marchera pas - List<String> list = - PluginHelper.toGenericList(objects, String.class); - Collections.sort(list); - result = new Vector<Object>(list); - } catch (IllegalArgumentException e) { - // keys are not string !!! - // can not sort keys - result = new Vector<Object>(objects); - } - return result.elements(); - } - - /** - * Load all properties from given {@code src} file using defined {@code defaultEncoding}. - * - * @param src source file - * @return this instance - * @throws IOException if any io pb - * @see #load(File, String) - */ - public SortedProperties load(File src) throws IOException { - return load(src, defaultEncoding); - } - - /** - * Load Properties from {@code src} file using given {@code defaultEncoding}. - * If this {@code encoding} is different from default ones - * {@link #ENCODING_DEFAULT}, {@link #ENCODING_LATIN1} - * and {@link #ENCODING_ASCII}. A specific {@link Reader} will - * be used to read the file. - * - * @param src File where Properties will be loaded - * @param encoding Encoding to use - * @throws IOException for any file errors - * @since 1.3 - * @return this instance - */ - public SortedProperties load(File src, String encoding) throws IOException { - Reader reader = new InputStreamReader(new FileInputStream(src), encoding); - try { - load(reader); - } finally { - reader.close(); - } - return this; - } - - /** - * Save properties in given {@code dst} file using defined {@code defaultEncoding}. - * - * @param dst output file - * @throws IOException if any io pb - * @see #store(File, String) - */ - public void store(File dst) throws IOException { - store(dst, defaultEncoding); - } - - /** - * Store Properties in {@code output} file using given {@code defaultEncoding}. - * If this {@code encoding} is different from default ones - * {@link #ENCODING_DEFAULT}, {@link #ENCODING_LATIN1} - * and {@link #ENCODING_ASCII}, a specific {@link Writer} will - * be used to save the file. Otherwise the default Properties behavior - * will escape unicode chars with <code>\u</code><i>xxxx</i>. - * - * @param dst File to save Properties - * @param encoding Encoding to use - * @throws IOException for any file errors - * @since 1.3 - */ - public void store(File dst, String encoding) throws IOException { - OutputStream stream = new FileOutputStream(dst); - try { - storeEncode(stream, encoding); - } finally { - stream.close(); - } - } - - /** - * If encoding is not the default Properties one, we will use a writer - * to use this custom encoding. - * <p/> - * We must call the right method depends on encoding, for a custom one - * the {@link #store(Writer, String)} method is used otherwise the - * default encoding 8859_1 must be used as superclass define it in - * {@link #store(OutputStream, String)}. - * <p/> - * Encoding {@link #ENCODING_DEFAULT}, - * {@link #ENCODING_LATIN1} and {@link #ENCODING_ASCII} - * are considered as default Properties one, so the old method will be use - * escaping unicode chars like <code>\u</code><i>xxxx</i>. - * - * @param stream OutputStream to save in - * @param encoding Encoding to use - * @throws IOException For any file errors - */ - protected void storeEncode(OutputStream stream, String encoding) throws IOException { - - // Specific encoding different from default ones - if (!ENCODING_LATIN1.equalsIgnoreCase(encoding) && - !ENCODING_DEFAULT.equals(encoding) && - !ENCODING_ASCII.equalsIgnoreCase(encoding)) { - - Writer writer = new OutputStreamWriter(stream, encoding); - try { - store(writer, null); - } finally { - writer.close(); - } - - } else { - - store(stream, null); - } - } - - /** - * Save properties in given {@code stream} file. {@code defaultEncoding} defined - * will be ignored to store the properties file. The default encoding is the - * basic Properties one (Latin1 ISO), unicode chars will be escaped - * like basic {@link #store(OutputStream, String)} method. - * - * @param dst output file - * @throws IOException if any io pb - */ - public void store(OutputStream dst) throws IOException { - store(dst, null); - } - - @Override - public void store(OutputStream out, String comments) - throws IOException { - - // Keep same implementation as super Properties class. Even if the - // encoding is modified, the resulting file always be an ASCII one - // because of escUnicode flag in store0 method. This method is overriden - // because of custom store0 method that can removeHeader. - - BufferedWriter writer = new BufferedWriter( - new OutputStreamWriter(out, "8859_1")); - try { - store0(writer, comments, true); - } finally { - writer.close(); - } - } - - @Override - public void store(Writer writer, String comments) throws IOException { - - // Keep same implementation as super Properties class. This method - // is overriden because of custom store0 method that can removeHeader. - - BufferedWriter bufferedWriter; - if (writer instanceof BufferedWriter) { - bufferedWriter = (BufferedWriter) writer; - } else { - bufferedWriter = new BufferedWriter(writer); - } - try { - store0(bufferedWriter, comments, false); - } finally { - writer.close(); - } - } - - protected void store0(BufferedWriter bw, String comments, boolean escUnicode) - throws IOException { - if (comments != null) { - writeComments(bw, comments); - } - - // Here is the modification wanted - if (!removeHeader) { - bw.write("#" + new Date().toString()); - bw.newLine(); - } - - synchronized (this) { - for (Enumeration e = keys(); e.hasMoreElements();) { - String key = (String) e.nextElement(); - String val = (String) get(key); - key = saveConvert(key, true, escUnicode); - /* No need to escape embedded and trailing spaces for value, hence - * pass false to flag. - */ - val = saveConvert(val, false, escUnicode); - bw.write(key + "=" + val); - bw.newLine(); - } - } - bw.flush(); - } - - // --- Copy implementations from Properties superClass, the store0 method - // is overriden and all method calls are private, so we copy the code here. - - protected String saveConvert(String theString, - boolean escapeSpace, - boolean escapeUnicode) { - int len = theString.length(); - int bufLen = len * 2; - if (bufLen < 0) { - bufLen = Integer.MAX_VALUE; - } - StringBuffer outBuffer = new StringBuffer(bufLen); - - for (int x = 0; x < len; x++) { - char aChar = theString.charAt(x); - // Handle common case first, selecting largest block that - // avoids the specials below - if ((aChar > 61) && (aChar < 127)) { - if (aChar == '\\') { - outBuffer.append('\\'); - outBuffer.append('\\'); - continue; - } - outBuffer.append(aChar); - continue; - } - switch (aChar) { - case ' ': - if (x == 0 || escapeSpace) - outBuffer.append('\\'); - outBuffer.append(' '); - break; - case '\t': - outBuffer.append('\\'); - outBuffer.append('t'); - break; - case '\n': - outBuffer.append('\\'); - outBuffer.append('n'); - break; - case '\r': - outBuffer.append('\\'); - outBuffer.append('r'); - break; - case '\f': - outBuffer.append('\\'); - outBuffer.append('f'); - break; - case '=': // Fall through - case ':': // Fall through - case '#': // Fall through - case '!': - outBuffer.append('\\'); - outBuffer.append(aChar); - break; - default: - if (((aChar < 0x0020) || (aChar > 0x007e)) & escapeUnicode) { - outBuffer.append('\\'); - outBuffer.append('u'); - outBuffer.append(toHex((aChar >> 12) & 0xF)); - outBuffer.append(toHex((aChar >> 8) & 0xF)); - outBuffer.append(toHex((aChar >> 4) & 0xF)); - outBuffer.append(toHex(aChar & 0xF)); - } else { - outBuffer.append(aChar); - } - } - } - return outBuffer.toString(); - } - - public void writeComments(BufferedWriter bw, String comments) - throws IOException { - bw.write("#"); - int len = comments.length(); - int current = 0; - int last = 0; - char[] uu = new char[6]; - uu[0] = '\\'; - uu[1] = 'u'; - while (current < len) { - char c = comments.charAt(current); - if (c > '\u00ff' || c == '\n' || c == '\r') { - if (last != current) - bw.write(comments.substring(last, current)); - if (c > '\u00ff') { - uu[2] = toHex((c >> 12) & 0xf); - uu[3] = toHex((c >> 8) & 0xf); - uu[4] = toHex((c >> 4) & 0xf); - uu[5] = toHex(c & 0xf); - bw.write(new String(uu)); - } else { - bw.newLine(); - if (c == '\r' && - current != len - 1 && - comments.charAt(current + 1) == '\n') { - current++; - } - if (current == len - 1 || - (comments.charAt(current + 1) != '#' && - comments.charAt(current + 1) != '!')) - bw.write("#"); - } - last = current + 1; - } - current++; - } - if (last != current) - bw.write(comments.substring(last, current)); - bw.newLine(); - } - - /** - * Convert a nibble to a hex character - * - * @param nibble the nibble to convert. - */ - protected char toHex(int nibble) { - return hexDigit[(nibble & 0xF)]; - } - -} Deleted: trunk/src/site/apt/mojo-examples.apt =================================================================== --- trunk/src/site/apt/mojo-examples.apt 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/src/site/apt/mojo-examples.apt 2012-11-11 08:14:19 UTC (rev 876) @@ -1,180 +0,0 @@ -~~~ -~~ #%L -~~ Maven helper plugin -~~ -~~ $Id$ -~~ $HeadURL$ -~~ %% -~~ Copyright (C) 2009 - 2010 Tony Chemit, 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>. -~~ #L% -~~~ - ----- -Mojo Examples ----- ----- -2009-10-02 ----- - -collect-files - - Collects the <<LICENSE.txt>> file and store reference in - <<target/collects.txt>>. - ------------------------------------------------------------------------------- -<plugin> - <groupId>org.nuiton</groupId> - <artifactId>helper-maven-plugin</artifactId> - <executions> - <execution> - <id>collect-files</id> - <goals> - <goal>collect-files</goal> - </goals> - <phase>generate-resources</phase> - <configuration> - <extraFiles>LICENSE.txt</extraFiles> - <descriptionFile>target/collects.txt</descriptionFile> - </configuration> - </execution> - - </executions> -</plugin> ------------------------------------------------------------------------------- - -share-server-secret - - Shares the secret of <<yourserverId>> says : - - * <<privateKey>> - - * <<password>> - - * <<username>> - - * <<passphrase>> - ------------------------------------------------------------------------------- -<plugin> - <groupId>org.nuiton</groupId> - <artifactId>helper-maven-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>share-server-secret</goal> - </goals> - <phase>validate</phase> - <configuration> - <serverId>yourServerId</serverId> - <privateKeyOut>privateKey</privateKeyOut> - <passwordOut>password</passwordOut> - <usernameOut>username</usernameOut> - <passphraseOut>passphrase</passphraseOut> - </configuration> - </execution> - </executions> -</plugin> ------------------------------------------------------------------------------- - -send-email - - Sends a email from <<noreply@noway.fr>> to <<receiver@noway.com>>. - - the content of the email is in <<target/emailContent.txt>>. - ------------------------------------------------------------------------------- -<plugin> - <groupId>org.nuiton</groupId> - <artifactId>helper-maven-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@noway.fr</email> - </mailSender> - <toAddresses> - <item>receiver@noway.com</item> - </toAddresses> - <smtpHost>smtp</smtpHost> - </configuration> -</plugin> ------------------------------------------------------------------------------- - -check-auto-container - - To test if all depencies of a project are in maven central repository : - --------------------------------------------------------------------------------- -<plugin> -<groupId>org.nuiton</groupId> -<artifactId>helper-maven-plugin</artifactId> -<executions> - <execution> - <id>check-central-safe</id> - <inherited>true</inherited> - <goals> - <goal>check-auto-container</goal> - </goals> - <phase>validate</phase> - <configuration> - <addMavenCentral>true</addMavenCentral> - </configuration> - </execution> -</executions> -</plugin> --------------------------------------------------------------------------------- - - To test if all depencies of a project are in the repository : - - * id : <<nuiton-central-releases>> - - * url : <<http://nexus.nuiton.org/nexus/content/repositories/nuiton-central-releases>> - --------------------------------------------------------------------------------- -<plugin> -<groupId>org.nuiton</groupId> -<artifactId>helper-maven-plugin</artifactId> -<executions> - <execution> - <id>check-central-safe</id> - <inherited>true</inherited> - <goals> - <goal>check-auto-container</goal> - </goals> - <phase>validate</phase> - <configuration> - <repositories> - <nuiton-central-releases> - http://nexus.nuiton.org/nexus/content/repositories/nuiton-central-releases - </nuiton-central-releases> - </repositories> - </configuration> - </execution> -</executions> -</plugin> --------------------------------------------------------------------------------- Deleted: trunk/src/site/apt/mojo-framework.apt =================================================================== --- trunk/src/site/apt/mojo-framework.apt 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/src/site/apt/mojo-framework.apt 2012-11-11 08:14:19 UTC (rev 876) @@ -1,72 +0,0 @@ -~~~ -~~ #%L -~~ Maven helper plugin -~~ -~~ $Id$ -~~ $HeadURL$ -~~ %% -~~ Copyright (C) 2009 - 2010 Tony Chemit, 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>. -~~ #L% -~~~ - ----- -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>> implements 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, throw an error if any problem. - - * <<checkSkip>> to test if can skip mojo execution (since 1.2.0) - - The core method is the <<doAction>> one, put there your logic. - - Note: since version 1.2.0 the <<doAction>> method will only be executed if the - mojo must be executed. you should no more do some tests here to know if the - mojo can be skip. - - -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/mojo-testFramework.apt =================================================================== --- trunk/src/site/apt/mojo-testFramework.apt 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/src/site/apt/mojo-testFramework.apt 2012-11-11 08:14:19 UTC (rev 876) @@ -1,202 +0,0 @@ -~~~ -~~ #%L -~~ Maven helper plugin -~~ -~~ $Id$ -~~ $HeadURL$ -~~ %% -~~ Copyright (C) 2009 - 2010 Tony Chemit, 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>. -~~ #L% -~~~ - ----- -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>> implements 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}}. Deleted: trunk/src/site/apt/mojo-usages.apt =================================================================== --- trunk/src/site/apt/mojo-usages.apt 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/src/site/apt/mojo-usages.apt 2012-11-11 08:14:19 UTC (rev 876) @@ -1,111 +0,0 @@ -~~~ -~~ #%L -~~ Maven helper plugin -~~ -~~ $Id$ -~~ $HeadURL$ -~~ %% -~~ Copyright (C) 2009 - 2010 Tony Chemit, 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>. -~~ #L% -~~~ - ----- -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. - - - See {{{./mojo-examples.html#collect-files}examples page}}. - -send-email - - This goal sends an email with a content coming from a file. - - See {{{./mojo-examples.html#send-email}examples page}}. - -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) - - * <<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). - - - See {{{./mojo-examples.html#share-server-secret}examples page}}. - -check-auto-container - - This mojo permits to test if all dependencies of a project are auto-contained - in given repositories. - - To use the mojo : - - * fill <<addCentralMaven>> to add central maven repository. - - * fill <<repositoriess>> to add more repositories to test. - - * use <<failIfNotSafe>> to fail build if there is some unsafe dependencies. - - [] - - See {{{./mojo-examples.html#check-auto-container}examples page}}. - \ No newline at end of file Modified: trunk/src/site/site_en.xml =================================================================== --- trunk/src/site/site_en.xml 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/src/site/site_en.xml 2012-11-11 08:14:19 UTC (rev 876) @@ -39,7 +39,7 @@ <skin> <groupId>org.apache.maven.skins</groupId> <artifactId>maven-fluido-skin</artifactId> - <version>1.2.2</version> + <version>1.3.0</version> </skin> <custom> @@ -62,6 +62,12 @@ <body> + <header> + <script type="text/javascript" + src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js"> + </script> + </header> + <breadcrumbs> <item name="${project.name}" href="index.html"/> </breadcrumbs> @@ -74,54 +80,12 @@ <menu name="User"> <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="check-auto-container" href="check-auto-container-mojo.html"/> - <item name="help" href="help-mojo.html"/> - </item> - <item name="Mojo usages" href="mojo-usages.html"/> - <item name="Mojo examples" href="mojo-examples.html"/> </menu> - <menu name="Developer"> - <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> - - <menu name="Download"> - <item href="http://nuiton.org/projects/list_files/maven-helper-plugin" - name="Sources bundles"/> - <item - href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}.jar" - name="Library (jar)"/> - <item - href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-javadoc.jar" - name="Javadoc (jar)"/> - <item - href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-sources.jar" - name="Sources (jar)"/> - <item - href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-tests.jar" - name="Test Library (jar)"/> - <item - href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-test-javadoc.jar" - name="Test Javadoc (jar)"/> - <item - href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-test-sources.jar" - name="Test Sources (jar)"/> - </menu> - <menu ref="reports"/> <footer> - <script type="text/javascript" - src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js"> - </script> - <div id='projectMetas' projectversion='${project.version}' platform='${project.platform}' Deleted: trunk/src/test/resources/log4j.properties =================================================================== --- trunk/src/test/resources/log4j.properties 2012-11-11 07:22:13 UTC (rev 875) +++ trunk/src/test/resources/log4j.properties 2012-11-11 08:14:19 UTC (rev 876) @@ -1,35 +0,0 @@ -### -# #%L -# Maven helper plugin -# -# $Id$ -# $HeadURL$ -# %% -# Copyright (C) 2009 - 2010 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>. -# #L% -### -# Global logging configuration -log4j.rootLogger=ERROR, stdout -# Console output... -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=[%p] (%F:%L) %M - %m%n -#log4j.appender.stdout.layout.ConversionPattern=[%p] [%t] (%F:%L) %M - %m%n - -# package level -log4j.logger.org.nuiton=INFO -
participants (1)
-
tchemit@users.nuiton.org