Author: tchemit Date: 2010-04-09 18:59:32 +0200 (Fri, 09 Apr 2010) New Revision: 1724 Log: reformat xml + add unit test for UpdateLicenseMojo Added: trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense.xml trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/project.xml trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/src/ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/src/MyBean.java trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense.xml trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/project.xml trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/src/ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/src/MyBean.java trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense.xml trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/project.xml trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/src/ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/src/MyBean.java Modified: trunk/src/it/settings.xml trunk/src/it/update-license/src/license/project.xml trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java Modified: trunk/src/it/settings.xml =================================================================== --- trunk/src/it/settings.xml 2010-04-09 10:09:45 UTC (rev 1723) +++ trunk/src/it/settings.xml 2010-04-09 16:59:32 UTC (rev 1724) @@ -21,36 +21,36 @@ <settings> - <profiles> - <profile> - <id>it-repo</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> - <repositories> - <repository> - <id>local.central</id> - <url>file:///@localRepository@</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </repository> - </repositories> - <pluginRepositories> - <pluginRepository> - <id>local.central</id> - <url>file:///@localRepository@</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </pluginRepository> - </pluginRepositories> - </profile> - </profiles> + <profiles> + <profile> + <id>it-repo</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <repositories> + <repository> + <id>local.central</id> + <url>file:///@localRepository@</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>local.central</id> + <url>file:///@localRepository@</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + </profile> + </profiles> </settings> Modified: trunk/src/it/update-license/src/license/project.xml =================================================================== --- trunk/src/it/update-license/src/license/project.xml 2010-04-09 10:09:45 UTC (rev 1723) +++ trunk/src/it/update-license/src/license/project.xml 2010-04-09 16:59:32 UTC (rev 1724) @@ -2,19 +2,19 @@ <project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd"> - <mainLicense>gpl_v3</mainLicense> - <licenseSets> - <licenseSet> - <licenseName>gpl_v3</licenseName> - <fileSets> - <fileSet> - <headerType>java</headerType> - <basedir>src/main/java</basedir> - <includes> - <include>**/*.java</include> - </includes> - </fileSet> - </fileSets> - </licenseSet> - </licenseSets> + <mainLicense>gpl_v3</mainLicense> + <licenseSets> + <licenseSet> + <licenseName>gpl_v3</licenseName> + <fileSets> + <fileSet> + <headerType>java</headerType> + <basedir>src/main/java</basedir> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + </fileSets> + </licenseSet> + </licenseSets> </project> Modified: trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java =================================================================== --- trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java 2010-04-09 10:09:45 UTC (rev 1723) +++ trunk/src/main/java/org/nuiton/license/plugin/UpdateLicenseMojo.java 2010-04-09 16:59:32 UTC (rev 1724) @@ -46,37 +46,62 @@ protected File descriptor; /** - * l'annee de creation du module (sera place dans le header) + * Name of project (or module). + * <p/> + * Will be used as description section of new header. * - * @parameter expression="${license.inceptionYear}" default-value="${project.inceptionYear}" + * @parameter expression="${license.projectName}" default-value="${project.name}" * @required * @since 2.1 */ - protected String inceptionYear; + protected String projectName; /** - * le nom de l'organisation (sera place dans le header) + * Name of project's organization. + * <p/> + * Will be used as copyrigth's holder in new header. * - * @parameter expression="${license.organizationName}" - * default-value="${project.organization.name}" + * @parameter expression="${license.organizationName}" default-value="${project.organization.name}" * @required * @since 2.1 */ protected String organizationName; /** - * le nom du projet (sera place dans le header) + * Inception year of the project. + * <p/> + * Will be used as first year of copyright section in new header. * - * @parameter expression="${license.projectName}" default-value="${project.name}" + * @parameter expression="${license.inceptionYear}" default-value="${project.inceptionYear}" * @required * @since 2.1 */ - protected String projectName; + protected String inceptionYear; /** - * To specify an external licenses repository resolver (says the base url - * of the repository). + * A flag to update copyright application time (change copyright last year + * if required) according to the last commit made on the processed file. * + * @parameter expression="${license.updateCopyright}" default-value="false" + * @since 2.1 + */ + protected boolean updateCopyright; + + /** + * A tag to place on files that will be ignored by the plugin. + * <p/> + * Sometimes, it is necessary to do this when file is under a specific license. + * + * @parameter expression="${license.ignoreTag}" default-value="%%Ignore-License" + * @since 2.1 + */ + protected String ignoreTag; + + + /** + * To specify an external extra licenses repository resolver (says the base + * url of the repository where the {@code license.properties} is present). + * * @parameter expression="${license.licenseResolver}" * @since 2.1 */ @@ -123,6 +148,8 @@ /** descriptor of project */ protected LicenseProject licenseProject; + protected Set<File> processedFiles; + @Override protected boolean checkSkip() { if (skipUpdateLicense) { @@ -133,23 +160,34 @@ } @Override - protected void init() throws Exception { + public void init() throws Exception { if (getLog().isDebugEnabled()) { // always be verbose in debug mode setVerbose(true); } - if (skipUpdateLicense) { + if (isSkipUpdateLicense()) { return; } - timestamp = System.nanoTime(); + if (updateCopyright) { + + //TODO-TC20100409 checks scm + // checks scm is ok + // for the moment, will only deal with svn except if scm + // offers a nice api to obtain last commit date on a file + + } + + // set timestamp used for temporary files + setTimestamp(System.nanoTime()); + // init licenses store licenseStore = createLicenseStore(licenseResolver); // load project descriptor - FileReader reader = new FileReader(descriptor); + FileReader reader = new FileReader(getDescriptor()); try { licenseProject = new LicenseProjectXpp3Reader().read(reader); } finally { @@ -157,12 +195,13 @@ } // check that license project is sane (known licenses + header types) - // + populate default license name in LicenseSet (with main License) - validateProjectfile(licenseProject, licenseStore, transformers); + // + populate default license name in LicenseSet (with main License) if + // none given for licenseSet + validateProjectFile(licenseProject, licenseStore, transformers); } @Override - protected void doAction() throws Exception { + public void doAction() throws Exception { // create a file header processor which updates license content only FileHeaderProcessor processor = new FileHeaderProcessor() { @@ -171,10 +210,15 @@ public FileHeaderFilter newFilter( FileHeader header, FileHeaderTransformer transformer) { - return new UpdateLicenseHeaderFilter(header, transformer); + return new UpdateLicenseHeaderFilter(header, + transformer, + isUpdateCopyright() + ); } }; + processedFiles = new HashSet<File>(); + for (LicenseSet licenseSet : licenseProject.getLicenseSets()) { // obtain license from definition @@ -182,7 +226,7 @@ License license = licenseStore.getLicense(licenseName); if (isVerbose()) { - getLog().info("process license \n" + license.getDescription()); + getLog().info("process " + license.getDescription()); } // file header to use if no header is found on a file @@ -200,6 +244,10 @@ for (FileSet fileSet : licenseSet.getFileSets()) { File basedir = new File(getProject().getBasedir(), fileSet.getBasedir()); + if (isVerbose()) { + getLog().info("process file set with basedir : " + basedir); + } + List<String> includes = fileSet.getIncludes(); if (includes.isEmpty()) { @@ -230,76 +278,92 @@ // treate all files of entry for (Map.Entry<File, String[]> entry : filestoTreate.entrySet()) { File entryBasedir = entry.getKey(); - getLog().info("start entry \n" + entryBasedir); + getLog().info("process entry " + entryBasedir); String[] paths = entry.getValue(); getLog().info(paths.length + " file(s) to treate."); for (String path : paths) { File file = new File(entryBasedir, path); + if (getProcessedFiles().contains(file)) { + getLog().info("skip already processed file " + file); + continue; + } + getProcessedFiles().add(file); updateFile(processor, file); } } } } + if (getProcessedFiles() != null) { + getLog().info(getProcessedFiles().size() + " file(s) were treated."); + } } public void updateFile(FileHeaderProcessor processor, File file) throws IOException { - getLog().debug("scan file " + file); + getLog().debug("start for file " + file); + // file where to write result - File processFile = new File(file.getAbsolutePath() + "_" + - timestamp); + File processFile = new File(file.getAbsolutePath() + "_" + getTimestamp()); + getLog().debug("will process into file " + processFile); if (isVerbose()) { getLog().info("process file " + file); } try { + processor.process(file, processFile); - boolean touched = processor.isTouched(); - if (touched) { + if (processor.isTouched()) { - getLog().info("header was updated for " + file); - } else { - if (processor.isDetectHeader()) { - getLog().warn( - "skip file " + file + - " (no license footer tag found : '##%*' !)"); - } else { + if (isVerbose()) { + getLog().info("header was updated for " + file); + } - // no license header found in file, add it - getLog().info("adding license header on file " + file); - String content = PluginHelper.readAsString( - file, - getEncoding() - ); + finalizeFile(file, processFile); + return; + } - //FIXME-TC-20100409 form xml files must add header after a xml prolog line - content = processor.getFullHeaderContent() + content; - if (!dryRun) { - writeFile(processFile, content, getEncoding()); - } - } + if (processor.isDetectHeader()) { + + // file has not a valid header (found a start process atg, but + // not an ending one), can not do anything + getLog().warn( + "skip file " + file + + " (no license footer tag found : '##%*' !)"); + + deleteFile(processFile); + return; } - if (keepBackup && !dryRun) { - File backupFile = new File(file.getAbsolutePath() + "~"); - if (isVerbose()) { - getLog().debug("backup original file " + file); - } - renameFile(file, backupFile); - } - if (dryRun) { + // file has no header dealed by the plugin + + String content = PluginHelper.readAsString(file, getEncoding()); + + //check that file is not marked to be ignored + if (content.contains(getIgnoreTag())) { + getLog().info("ignore file (using " + getIgnoreTag() + ")"); + deleteFile(processFile); - } else { - renameFile(processFile, file); + return; } + // no header and not marked to be ignored : add a new header + getLog().info("adding license header on file " + file); + + //FIXME-TC-20100409 form xml files must add header after a xml prolog line + content = processor.getFullHeaderContent() + content; + if (!isDryRun()) { + writeFile(processFile, content, getEncoding()); + } + + finalizeFile(file, processFile); + } catch (Exception e) { getLog().warn( "skip file " + file + " (could not process " + - "for reason : " + e.getMessage() + ")"); + "for reason : " + e.getMessage() + ")", e); deleteFile(processFile); } finally { @@ -308,10 +372,43 @@ } } + protected void finalizeFile(File file, File processFile) throws IOException { + + if (isKeepBackup() && !isDryRun()) { + File backupFile = new File(file.getAbsolutePath() + "~"); + + if (backupFile.exists()) { + + // always delete backup file, before the renaming + deleteFile(backupFile); + } + + if (isVerbose()) { + getLog().debug("backup original file " + file); + } + + renameFile(file, backupFile); + } + + if (isDryRun()) { + + // dry run, delete temporary file + deleteFile(processFile); + } else { + + // replace file with + renameFile(processFile, file); + } + } + public long getTimestamp() { return timestamp; } + private File getDescriptor() { + return descriptor; + } + public String getProjectName() { return projectName; } @@ -324,6 +421,14 @@ return organizationName; } + public boolean isUpdateCopyright() { + return updateCopyright; + } + + public String getIgnoreTag() { + return ignoreTag; + } + public boolean isKeepBackup() { return keepBackup; } @@ -336,6 +441,10 @@ return skipUpdateLicense; } + public Set<File> getProcessedFiles() { + return processedFiles; + } + public void setDryRun(boolean dryRun) { this.dryRun = dryRun; } @@ -364,7 +473,16 @@ this.organizationName = organizationName; } - protected void validateProjectfile( + + public void setUpdateCopyright(boolean updateCopyright) { + this.updateCopyright = updateCopyright; + } + + public void setIgnoreTag(String ignoreTag) { + this.ignoreTag = ignoreTag; + } + + protected void validateProjectFile( LicenseProject licenseProject, LicenseStore licenseStore, Map<String, FileHeaderTransformer> transformers) @@ -408,6 +526,17 @@ } } + /** + * Build a default header given the parameters. + * + * @param license the license type ot use in header + * @param projectName project name as header description + * @param inceptionYear first year of copyright + * @param copyrightHolder holder of copyright + * @param encoding encoding used to read or write files + * @return the new file header + * @throws IOException if any problem while creating file header + */ protected FileHeader buildDefaultFileHeader( License license, String projectName, @@ -416,9 +545,13 @@ String encoding) throws IOException { FileHeader result = new FileHeader(); result.setDescription(projectName); - result.setLicense(license.getHeaderContent(encoding)); + + String licenseContent = license.getHeaderContent(encoding); + result.setLicense(licenseContent); + Integer firstYear = Integer.valueOf(inceptionYear); result.setCopyrightFirstYear(firstYear); + Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); Integer lastYear = cal.get(Calendar.YEAR); @@ -431,9 +564,12 @@ public class UpdateLicenseHeaderFilter extends FileHeaderFilter { + protected final boolean updateCopyright; + public UpdateLicenseHeaderFilter(FileHeader header, - FileHeaderTransformer transformer) { + FileHeaderTransformer transformer, boolean updateCopyright) { super(header, transformer); + this.updateCopyright = updateCopyright; } @Override @@ -450,8 +586,15 @@ // updates license fileHeader.setLicense(header.getLicense()); + if (updateCopyright) { + // 1) obtain the svn last comit on this file + + // 2) compute the last year of copyright + + // 3) if necessary update last year + //fileHeader.setCopyrightLastYear(lastYear); + } // build new brut header (with no boxing) - String newHeader = transformer.toString(fileHeader); // box with process tag Modified: trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java 2010-04-09 10:09:45 UTC (rev 1723) +++ trunk/src/test/java/org/nuiton/license/plugin/UpdateHeaderMojoTest.java 2010-04-09 16:59:32 UTC (rev 1724) @@ -32,7 +32,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -/** @author chemit */ +/** + * @author tchemit <chemit àcodelutin.com> + * @since 1.0 + * @deprecated since 2.1, will be remove soon. + */ +@Deprecated public class UpdateHeaderMojoTest extends AbstractMojoTest<UpdateHeaderMojo> { public static final String _LICENSE_TO_CHANGE_ = @@ -84,21 +89,33 @@ assertTrue("generated file " + f + " was not found...", f.exists()); + String content = PluginHelper.readAsString(f, "utf-8"); if (mojo.isVerbose()) { mojo.getLog().info("check generated file " + f); } for (String p : mandatoryPatterns) { - checkPattern(content, p, true, f); + + checkPattern(f,content, p, true); } for (String p : excludePatterns) { - checkPattern(content, p, false, f); + checkPattern(f, content, p, false); } } } } + /** + * @param content + * @param pattern + * @param required + * @param f + * @throws IOException + * @deprecated since 2.1, prefer use the + * {@link #checkPattern(File, String, String, boolean)} method instead. + */ + @Deprecated protected void checkPattern(String content, String pattern, boolean required, Added: trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java (rev 0) +++ trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java 2010-04-09 16:59:32 UTC (rev 1724) @@ -0,0 +1,125 @@ +package org.nuiton.license.plugin; + +import org.junit.Assert; +import org.junit.Test; +import org.nuiton.plugin.AbstractMojoTest; +import org.nuiton.plugin.PluginHelper; + +import java.io.File; + +/** + * Tests the {@link UpdateLicenseMojo}. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.1 + */ +public class UpdateLicenseMojoTest extends AbstractMojoTest<UpdateLicenseMojo> { + @Override + protected String getGoalName(String methodName) { + return "update-license"; + } + + @Test + public void addLicense() throws Exception { + + File f = getMyBeanFile("addLicense"); + + UpdateLicenseMojo mojo = getMojo(); + String content; + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // check no header + checkPattern(f, content, "Copyright (C) 2010", false); + checkPattern(f, content, "Project name : maven-license-plugin-java", false); + checkPattern(f, content, "Organization is CodeLutin", false); + + mojo.execute(); + Assert.assertEquals(1, mojo.getProcessedFiles().size()); + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // check header + checkPattern(f, content, "Copyright (C) 2010", true); + checkPattern(f, content, "Project name : maven-license-plugin-java", true); + checkPattern(f, content, "Organization is CodeLutin", true); + } + + @Test + public void updateLicense() throws Exception { + + File f = getMyBeanFile("updateLicense"); + + UpdateLicenseMojo mojo = getMojo(); + + String content; + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // check header + checkPattern(f, content, "Copyright (C) 2000 Codelutin do NOT update!", true); + checkPattern(f, content, "License Test :: do NOT update!", true); + checkPattern(f, content, "Fake to be removed!", true); + + mojo.execute(); + Assert.assertEquals(1, mojo.getProcessedFiles().size()); + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // check header (description + copyright) does not changed + checkPattern(f, content, "Copyright (C) 2000 Codelutin do NOT update!", true); + checkPattern(f, content, "License Test :: do NOT update!", true); + + // check license changed + checkPattern(f, content, "Fake to be removed!", false); + + } + + + @Test + public void ignoreLicense() throws Exception { + + File f = getMyBeanFile("ignoreLicense"); + + UpdateLicenseMojo mojo = getMojo(); + + String content; + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // check header + checkPattern(f, content, "Copyright (C) 2000 Codelutin Do not update!", true); + checkPattern(f, content, " * %%Ignore-License", true); + checkPattern(f, content, "yet another license", true); + checkPattern(f, content, "NEVER_FINd_ME!", false); + + mojo.execute(); + Assert.assertEquals(1, mojo.getProcessedFiles().size()); + + content = PluginHelper.readAsString(f, mojo.getEncoding()); + + // check header (description + copyright) does not changed + checkPattern(f, content, "Copyright (C) 2000 Codelutin Do not update!", true); + checkPattern(f, content, " * %%Ignore-License", true); + checkPattern(f, content, "yet another license", true); + checkPattern(f, content, "NEVER_FINd_ME!", false); + } + + protected File getMyBeanFile(String testName) { + File f = PluginHelper.getFile(getBasedir(), + "target", + "test-classes", + "org", + "nuiton", + "license", + "plugin", + "updateLicenseMojoTest", + testName, + "src", + "MyBean.java" + ); + return f; + } + + +} Property changes on: trunk/src/test/java/org/nuiton/license/plugin/UpdateLicenseMojoTest.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Modified: trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java =================================================================== --- trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java 2010-04-09 10:09:45 UTC (rev 1723) +++ trunk/src/test/java/org/nuiton/license/plugin/header/transformer/AbstractFileHeaderTransformerTest.java 2010-04-09 16:59:32 UTC (rev 1724) @@ -9,9 +9,9 @@ import java.util.regex.Matcher; import static org.nuiton.license.plugin.header.transformer.AbstractFileHeaderTransformer.COPYRIGHT_PATTERN; -import static org.nuiton.license.plugin.header.transformer.AbstractFileHeaderTransformer.DEFAULT_PROCESS_END_TAG; -import static org.nuiton.license.plugin.header.transformer.AbstractFileHeaderTransformer.DEFAULT_PROCESS_START_TAG; -import static org.nuiton.license.plugin.header.transformer.AbstractFileHeaderTransformer.DEFAULT_SECTION_DELIMITER; +import static org.nuiton.license.plugin.header.transformer.FileHeaderTransformer.DEFAULT_PROCESS_END_TAG; +import static org.nuiton.license.plugin.header.transformer.FileHeaderTransformer.DEFAULT_PROCESS_START_TAG; +import static org.nuiton.license.plugin.header.transformer.FileHeaderTransformer.DEFAULT_SECTION_DELIMITER; import static org.nuiton.license.plugin.header.transformer.FileHeaderTransformer.LINE_SEPARATOR; import static org.nuiton.license.plugin.header.transformer.JavaFileHeaderTransformer.*; Added: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/project.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/project.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/project.xml 2010-04-09 16:59:32 UTC (rev 1724) @@ -0,0 +1,20 @@ +<?xml version='1.0' encoding='UTF-8'?> +<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd"> + <mainLicense>gpl_v3</mainLicense> + <licenseSets> + <licenseSet> + <licenseName>lgpl_v3</licenseName> + <fileSets> + <fileSet> + <headerType>java</headerType> + <basedir>addLicense/src</basedir> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + </fileSets> + </licenseSet> + </licenseSets> +</project> Added: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/src/MyBean.java =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/src/MyBean.java (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/src/MyBean.java 2010-04-09 16:59:32 UTC (rev 1724) @@ -0,0 +1,10 @@ +package org.nuiton.license.plugin.updateLicenseMojoTest.addLicense.src; + +/** + * this class has no license, a new default one will be added. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.1 + */ +public class MyBean { +} Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/src/MyBean.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense.xml 2010-04-09 16:59:32 UTC (rev 1724) @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <groupId>org.nuiton.license.test</groupId> + <artifactId>maven-license-plugin-java</artifactId> + <version>0</version> + <modelVersion>4.0.0</modelVersion> + + <name>Add License to MyBean</name> + + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <descriptor> + target/test-classes/org/nuiton/license/plugin/updateLicenseMojoTest/addLicense/project.xml + </descriptor> + <projectName>Project name : maven-license-plugin-java</projectName> + <organizationName>Organization is CodeLutin</organizationName> + <inceptionYear>2010</inceptionYear> + <ignoreTag>NEVER_FINd_ME!</ignoreTag> + <encoding>UTF-8</encoding> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <goals> + <goal>update-license</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file Added: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/project.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/project.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/project.xml 2010-04-09 16:59:32 UTC (rev 1724) @@ -0,0 +1,20 @@ +<?xml version='1.0' encoding='UTF-8'?> +<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd"> + <mainLicense>gpl_v3</mainLicense> + <licenseSets> + <licenseSet> + <licenseName>lgpl_v3</licenseName> + <fileSets> + <fileSet> + <headerType>java</headerType> + <basedir>ignoreLicense/src</basedir> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + </fileSets> + </licenseSet> + </licenseSets> +</project> Added: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/src/MyBean.java =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/src/MyBean.java (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/src/MyBean.java 2010-04-09 16:59:32 UTC (rev 1724) @@ -0,0 +1,17 @@ +/* + * %%Ignore-License + * + * yet another license + * + * Copyright (C) 2000 Codelutin Do not update! + */ +package org.nuiton.license.plugin.updateLicenseMojoTest.ignoreLicense.src; + +/** + * this class has no license, a new default one will be added. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.1 + */ +public class MyBean { +} \ No newline at end of file Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/src/MyBean.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense.xml 2010-04-09 16:59:32 UTC (rev 1724) @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <groupId>org.nuiton.license.test</groupId> + <artifactId>maven-license-plugin-java</artifactId> + <version>0</version> + <modelVersion>4.0.0</modelVersion> + + <name>Add License to MyBean</name> + + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <descriptor> + target/test-classes/org/nuiton/license/plugin/updateLicenseMojoTest/ignoreLicense/project.xml + </descriptor> + <projectName>NEVER_FINd_ME!</projectName> + <organizationName>NEVER_FINd_ME!</organizationName> + <inceptionYear>2010</inceptionYear> + <ignoreTag>%%Ignore-License</ignoreTag> + <encoding>UTF-8</encoding> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <goals> + <goal>update-license</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file Added: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/project.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/project.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/project.xml 2010-04-09 16:59:32 UTC (rev 1724) @@ -0,0 +1,21 @@ +<?xml version='1.0' encoding='UTF-8'?> + +<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProject-1.0.0.xsd"> + <mainLicense>gpl_v3</mainLicense> + <licenseSets> + <licenseSet> + <licenseName>lgpl_v3</licenseName> + <fileSets> + <fileSet> + <headerType>java</headerType> + <basedir>updateLicense/src</basedir> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + </fileSets> + </licenseSet> + </licenseSets> +</project> Added: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/src/MyBean.java =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/src/MyBean.java (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/src/MyBean.java 2010-04-09 16:59:32 UTC (rev 1724) @@ -0,0 +1,20 @@ +/* + * #%L + * License Test :: do NOT update! + * -- + * Copyright (C) 2000 Codelutin do NOT update! + * -- + * Fake to be removed! + * #L% + */ + +/** + * this class owns a header, only license will be updated. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.1 + */ +package org.nuiton.license.plugin.updateLicenseMojoTest.updateLicense.src; + +public class MyBean { +} Property changes on: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/src/MyBean.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense.xml =================================================================== --- trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense.xml (rev 0) +++ trunk/src/test/resources/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense.xml 2010-04-09 16:59:32 UTC (rev 1724) @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <groupId>org.nuiton.license.test</groupId> + <artifactId>maven-license-plugin-java</artifactId> + <version>0</version> + <modelVersion>4.0.0</modelVersion> + + <name>Update License to MyBean</name> + + <build> + + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-license-plugin</artifactId> + <configuration> + <descriptor> + target/test-classes/org/nuiton/license/plugin/updateLicenseMojoTest/updateLicense/project.xml + </descriptor> + <projectName>Project name : maven-license-plugin-java</projectName> + <organizationName>Organization is CodeLutin</organizationName> + <inceptionYear>2010</inceptionYear> + <ignoreTag>NEVER_FINd_ME!</ignoreTag> + <encoding>UTF-8</encoding> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <goals> + <goal>update-license</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file