Author: tchemit Date: 2009-08-27 16:13:04 +0200 (Thu, 27 Aug 2009) New Revision: 553 Modified: trunk/src/main/java/org/nuiton/license/plugin/LicensePlugin.java Log: can use add-license plugin for all pom types Modified: trunk/src/main/java/org/nuiton/license/plugin/LicensePlugin.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/LicensePlugin.java 2009-08-26 20:12:58 UTC (rev 552) +++ trunk/src/main/java/org/nuiton/license/plugin/LicensePlugin.java 2009-08-27 14:13:04 UTC (rev 553) @@ -105,8 +105,10 @@ */ protected boolean verbose; /** - * Un flag pour farie une copie nommé dans META-INF (prefixe avec le nom de l'artifact). + * Un flag pour faire une copie nommée dans META-INF (prefixe avec le nom de l'artifact). * + * Cette option n'est utilisable que sur des modules avec un class-path (pas pour un pom) + * * @parameter expression="${helper.copyToMETA_INF}" default-value="false" * @since 1.0.0 */ @@ -124,9 +126,14 @@ super("all files are up-to-date."); } + protected boolean hasClassPath() { + return !("pom".equals(project.getPackaging()) || "site".equals(project.getPackaging())); + } + @Override protected boolean ensurePackaging() { - return project != null && ("pom".equals(project.getPackaging()) || "site".equals(project.getPackaging())); + return false; +// return project != null && ("pom".equals(project.getPackaging()) || "site".equals(project.getPackaging())); } boolean doGenerate; @@ -141,16 +148,12 @@ doGenerate = !isFileNewerThanPomFile(licenseFile); } - //if (doGenerate) { - // acquire license LicenseFactory factory = LicenseFactory.newInstance(extraResolver); license = factory.revolv(licenseName); - //} - if (licenseFilename == null || licenseFilename.isEmpty()) { licenseFilename = licenseName; } @@ -182,16 +185,17 @@ copyFile(licenseContent, licenseFile, encoding); } - // copy LICENSE.txt to classpath - File target = new File(outputDirectory, licenseFile.getName()); + if (hasClassPath()) { + // copy LICENSE.txt to classpath + File target = new File(outputDirectory, licenseFile.getName()); - copyFile(licenseFile, target); + copyFile(licenseFile, target); - if (copyToMETA_INF) { - copyFile(licenseFile, new File(outputDirectory, "META-INF" + File.separator + project.getArtifactId() + "-" + licenseFile.getName())); + if (copyToMETA_INF) { + copyFile(licenseFile, new File(outputDirectory, "META-INF" + File.separator + project.getArtifactId() + "-" + licenseFile.getName())); + } + addResourceDir(outputDirectory.getAbsolutePath()); } - addResourceDir(outputDirectory.getAbsolutePath()); - } public File getLicenseFile() {