Skip to content

Commit

Permalink
Merge pull request mojohaus#199 from obfischer/gh-issue-193-take-rule…
Browse files Browse the repository at this point in the history
…s-from-classpath

Fixed mojohaus#193
  • Loading branch information
khmarbaise authored Aug 21, 2017
2 parents 8fe644f + 1ce664a commit be04640
Show file tree
Hide file tree
Showing 18 changed files with 422 additions and 116 deletions.
12 changes: 6 additions & 6 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
* [Fixed Issue 182][issue-182]

Add goal for updating the SCM tag in the POM.

* [Fixed Issue 197][issue-197]

Java 1.7 as prerequisite.

* [Fixed Issue 198][issue-198]

Update version of modules which are not children but part of reactor.

* [Fixed Issue 185][issue-185]

Unable to set dependencyReportFormat as parameter anymore.
Thanks to Ilja Dubinin.

* [Fixed Issue 187][issue-187]

create target directory when run dependency update report.
Thanks to Ilja Dubinin.

* [Pull Request #189][pull-189]

Fixed inccorect links. Thanks to Anton Johansson.
Expand Down
2 changes: 2 additions & 0 deletions src/it/it-rules-via-classpath-001/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:use-latest-releases
invoker.buildResult = failure
32 changes: 32 additions & 0 deletions src/it/it-rules-via-classpath-001/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>localhost</groupId>
<artifactId>it-rules-via-classpath-001</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>GH-193: Fail if resource is not found</name>

<dependencies>
<dependency>
<groupId>localhost</groupId>
<artifactId>version-rules</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<configuration>
<rulesUri>classpath:///package/foo/bar/rule-set.xml</rulesUri>
</configuration>
</plugin>
</plugins>
</build>

</project>
22 changes: 22 additions & 0 deletions src/it/it-rules-via-classpath-001/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import java.io.*;
import org.codehaus.plexus.util.FileUtils;

try
{
File file = new File( basedir, "build.log" );
String buf = FileUtils.fileRead( file, "UTF-8" );
String expectedMessage = "Resource \"classpath:///package/foo/bar/rule-set.xml\" not found in classpath.";

if ( buf.indexOf( expectedMessage ) < 0 )
{
System.err.println( "Build should have failed as the requested resource is not present." );
return false;
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}

return true;
2 changes: 2 additions & 0 deletions src/it/it-rules-via-classpath-002/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoker.goals=clean install ${project.groupId}:${project.artifactId}:${project.version}:use-latest-releases
invoker.buildResult = success
46 changes: 46 additions & 0 deletions src/it/it-rules-via-classpath-002/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>localhost</groupId>
<artifactId>it-rules-via-classpath-002</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>GH-193: Succeed if resource is found</name>

<dependencies>
<dependency>
<groupId>localhost</groupId>
<artifactId>version-rules</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>localhost</groupId>
<artifactId>setup-provide-rules-in-jar</artifactId>
<version>1.0</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<configuration>
<rulesUri>classpath:///package/foo/bar/rules.xml</rulesUri>
</configuration>
<dependencies>
<dependency>
<groupId>localhost</groupId>
<artifactId>setup-provide-rules-in-jar</artifactId>
<version>1.0</version>
</dependency>

</dependencies>
</plugin>
</plugins>
</build>

</project>
22 changes: 22 additions & 0 deletions src/it/it-rules-via-classpath-002/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import java.io.*;
import org.codehaus.plexus.util.FileUtils;

try
{
File file = new File( basedir, "build.log" );
String buf = FileUtils.fileRead( file, "UTF-8" );
String expectedMessage = "Resource \"classpath:///package/foo/bar/rules.xml\" not found in classpath.";

if ( buf.indexOf( expectedMessage ) >= 0 )
{
System.err.println( "File resource rules.xml should have been found in the classpath." );
return false;
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}

return true;
2 changes: 2 additions & 0 deletions src/it/it-rules-via-classpath-003/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoker.goals=clean install ${project.groupId}:${project.artifactId}:${project.version}:use-latest-releases
invoker.buildResult = success
45 changes: 45 additions & 0 deletions src/it/it-rules-via-classpath-003/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>localhost</groupId>
<artifactId>it-rules-via-classpath-003</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>GH-193: Found rules file is used by the plugin</name>

<dependencies>
<dependency>
<groupId>localhost</groupId>
<artifactId>version-rules</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>localhost</groupId>
<artifactId>setup-provide-rules-in-jar</artifactId>
<version>1.0</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<configuration>
<rulesUri>classpath:///package/foo/bar/rules.xml</rulesUri>
</configuration>
<dependencies>
<dependency>
<groupId>localhost</groupId>
<artifactId>setup-provide-rules-in-jar</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

</project>
21 changes: 21 additions & 0 deletions src/it/it-rules-via-classpath-003/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import java.io.*;
import org.codehaus.plexus.util.FileUtils;

try
{
File file = new File( basedir, "pom.xml" );
String buf = FileUtils.fileRead( file, "UTF-8" );

if ( buf.indexOf( "<version>3.0.1-1.1</version>" ) < 0 )
{
System.err.println( "Version of version-rules not bumped to 3.0.1-1.1" );
return false;
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}

return true;
1 change: 1 addition & 0 deletions src/it/setup-provide-rules-in-jar/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
invoker.goals=clean install
12 changes: 12 additions & 0 deletions src/it/setup-provide-rules-in-jar/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>localhost</groupId>
<artifactId>setup-provide-rules-in-jar</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>GH-193: Provide a rules file within a jar</name>


</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ruleset comparisonMethod="maven">
<rules>
<rule groupId="localhost" artifactId="version-rules" comparisonMethod="mercury"/>
</rules>
</ruleset>
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ public abstract class AbstractVersionsReport
private String serverId;

/**
* The Wagon URI of a ruleSet file containing the rules that control how to compare version numbers.
* URI of a ruleSet file containing the rules that control how to compare
* version numbers. The URI could be either a Wagon URI or a classpath URI
* (e.g. <code>classpath:///package/sub/package/rules.xml</code>).
*
* @since 1.0-alpha-3
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ public abstract class AbstractVersionsUpdaterMojo
private String serverId;

/**
* The Wagon URI of a ruleSet file containing the rules that control how to compare version numbers.
* URI of a ruleSet file containing the rules that control how to compare
* version numbers. The URI could be either a Wagon URI or a classpath URI
* (e.g. <code>classpath:///package/sub/package/rules.xml</code>).
*
* @since 1.0-alpha-3
*/
Expand Down
Loading

0 comments on commit be04640

Please sign in to comment.