Skip to content

Commit

Permalink
[MOJO-1671] Allow system properties to be used for download-licenses …
Browse files Browse the repository at this point in the history
…mojo

Submitted by: Elliot Metsger

o applied without change

git-svn-id: file:///home/tiste/MOJOHAUS-TO-GIT/SVN-MOJO-WIP/trunk/mojo/license-maven-plugin@14050 52ab4f32-60fc-0310-b215-8acea882cd1b
  • Loading branch information
pgier committed May 10, 2011
1 parent 3890df0 commit fd1ba83
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals = -DlicensesConfigFile=./licenses.xml -DlicensesOutputDirectory=./licenseout -DlicensesOutputFile=licensesout.xml clean license:download-licenses
14 changes: 14 additions & 0 deletions src/it/download-licenses-configured-alt-location/licenses.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<licenseSummary>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<licenses>
<license>
<name>Apache License 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
</dependency>
</dependencies>
</licenseSummary>
40 changes: 40 additions & 0 deletions src/it/download-licenses-configured-alt-location/pom.xml
Original file line number Diff line number Diff line change
@@ -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">
<modelVersion>4.0.0</modelVersion>

<groupId>org.codehaus.mojo.license</groupId>
<artifactId>it-test</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Integration Test</name>
<url>http://maven.apache.org</url>
<description>
Check default execution.
</description>

<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>@pom.version@</version>
<executions>
<execution>
<goals>
<goal>download-licenses</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.codehaus.mojo;

public class HelloWorld
{

/**
* @param args
*/
public static void main( String[] args )
{
// TODO Auto-generated method stub

}

}
26 changes: 26 additions & 0 deletions src/it/download-licenses-configured-alt-location/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import java.io.*;
import java.util.*;

try
{
File licenseFile = new File( basedir, "licenseout/apache license 2.0 - license-2.0.txt" );
if ( !licenseFile.isFile() )
{
System.err.println( "Could not find license file: " + licenseFile );
return false;
}

File summaryFile = new File( basedir, "licensesout.xml" );
if ( !summaryFile.isFile() )
{
System.err.println( "Could not find license file: " + summaryFile );
return false;
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}

return true;
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,24 @@ public class DownloadLicensesMojo

/**
* Input file containing a mapping between each dependency and it's license information.
*
* @parameter default-value="${project.basedir}/src/license/licenses.xml"
*
* @parameter default-value="${project.basedir}/src/license/licenses.xml" expression="${licensesConfigFile}"
* @since 1.0
*/
private File licensesConfigFile;

/**
* The directory to which the dependency licenses should be written.
*
* @parameter default-value="${project.build.directory}/generated-resources/licenses"
*
* @parameter default-value="${project.build.directory}/generated-resources/licenses" expression="${licensesOutputDirectory}
* @since 1.0
*/
private File licensesOutputDirectory;

/**
* The output file containing a mapping between each dependency and it's license information.
*
* @parameter default-value="${project.build.directory}/generated-resources/licenses.xml"
*
* @parameter default-value="${project.build.directory}/generated-resources/licenses.xml" expression="${licensesOutputFile}
* @since 1.0
*/
private File licensesOutputFile;
Expand Down

0 comments on commit fd1ba83

Please sign in to comment.