Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
tavin committed May 3, 2016
2 parents fff6d1f + ddf38a1 commit 24450e8
Show file tree
Hide file tree
Showing 81 changed files with 1,706 additions and 1,484 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ jdk:
- openjdk6
- oraclejdk7
- oraclejdk8
# We don't need an install before
# we run the unit and integration tests.
install: true
script: "mvn --show-version --errors --batch-mode -Prun-its clean verify"
cache:
directories:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This is the [versions-maven-plugin](http://www.mojohaus.org/versions-maven-plugin/).

[![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/mojohaus/versions-maven-plugin.svg?label=License)](http://www.apache.org/licenses/)
[![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.mojo/versions-maven-plugin.svg?label=Maven%20Central)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.codehaus.mojo%22%20AND%20a%3A%22versions-maven-plugin%22)
[![Build Status](https://travis-ci.org/mojohaus/versions-maven-plugin.svg?branch=master)](https://travis-ci.org/mojohaus/versions-maven-plugin)

## Releasing
Expand Down
16 changes: 10 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.mojo</groupId>
<artifactId>mojo-parent</artifactId>
<version>34</version>
<version>39</version>
</parent>

<artifactId>versions-maven-plugin</artifactId>
Expand Down Expand Up @@ -79,8 +79,8 @@
</prerequisites>

<scm>
<connection>scm:git:git@github.com:mojohaus/versions-maven-plugin.git</connection>
<developerConnection>scm:git:git@github.com:mojohaus/versions-maven-plugin.git</developerConnection>
<connection>scm:git:https://github.com/mojohaus/versions-maven-plugin.git</connection>
<developerConnection>scm:git:ssh://git@github.com/mojohaus/versions-maven-plugin.git</developerConnection>
<url>https://github.com/mojohaus/versions-maven-plugin</url>
</scm>
<issueManagement>
Expand Down Expand Up @@ -260,7 +260,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<!--version>4.11</version-->
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -290,7 +289,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>1.10</version>
<version>2.0.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand All @@ -310,6 +309,11 @@
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
Expand Down Expand Up @@ -428,7 +432,7 @@
</plugin>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<version>1.10</version>
<version>2.0.0</version>
<reportSets>
<reportSet>
<reports>
Expand Down
100 changes: 100 additions & 0 deletions src/it/it-set-009/alternative-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<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-set-009</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>set</name>

<description>Tests operations with a parent pom with an alternative name</description>

<modules>
<module>child</module>
</modules>

<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-2</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.3.1</version>
</plugin>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.4.1</version>
</plugin>
<plugin>
<artifactId>maven-rar-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-7</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.0.4</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-alpha-1</version>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>
15 changes: 15 additions & 0 deletions src/it/it-set-009/child/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<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>

<parent>
<groupId>localhost</groupId>
<artifactId>it-set-009</artifactId>
<version>1.0</version>
<relativePath>..\alternative-pom.xml</relativePath>
</parent>

<artifactId>it-set-009-child-1</artifactId>
<packaging>pom</packaging>

</project>
2 changes: 2 additions & 0 deletions src/it/it-set-009/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoker.goals=-f alternative-pom.xml ${project.groupId}:${project.artifactId}:${project.version}:set -DnewVersion=2.0
invoker.buildResult=success
58 changes: 58 additions & 0 deletions src/it/it-set-009/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import org.apache.commons.lang.StringUtils

import javax.xml.parsers.DocumentBuilderFactory
import javax.xml.xpath.XPathFactory

class Checker
{
def result = true;
def basedir;

public Checker(File basedir) {
this.basedir = basedir;
}

def readXPath( String pom, String xPathExpression )
{
def stream = new FileInputStream( new File( basedir, pom ) );
try
{
return XPathFactory.newInstance()
.newXPath()
.evaluate( xPathExpression, DocumentBuilderFactory.newInstance()
.newDocumentBuilder()
.parse( stream ).documentElement );
}
finally
{
stream.close();
}
}

Checker check( String message, String pom, String xpath, String expected )
{
if ( result )
{
try
{
def actual = readXPath( pom, xpath )
if ( !StringUtils.equals( expected, actual ) )
{
System.out.println( pom + " [xpath:" + xpath + "] expected '" + expected + "' found '" + actual + "' : " + message );
result = false;
}
}
catch ( Throwable t )
{
t.printStackTrace();
result = false;
}
}
return this;
}
}

return new Checker(basedir)
.check( "alternative-pom.xml change", "alternative-pom.xml", "/project/version", "2.0")
.check( "child/pom.xml change", "child/pom.xml", "/project/parent/version", "2.0")
.result;
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
* under the License.
*/

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
Expand All @@ -29,12 +35,6 @@
import org.apache.maven.shared.artifact.filter.PatternExcludesArtifactFilter;
import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

/**
* Base class for a mojo that updates dependency versions.
*
Expand Down Expand Up @@ -73,43 +73,47 @@ public abstract class AbstractVersionsDependencyUpdaterMojo
private String excludesList = null;

/**
* A list of artifact patterns to include. Follows the pattern
* "groupId:artifactId:type:classifier:version". This configuration setting is ignored if {@link #includesList} is
* defined.
* A list of artifact patterns to include. Follows the pattern "groupId:artifactId:type:classifier:version". This
* configuration setting is ignored if {@link #includesList} is defined.
*
* @parameter
* @since 1.0-beta-1
*/
private String[] includes = null;

/**
* A list of artifact patterns to exclude. Follows the pattern
* "groupId:artifactId:type:classifier:version". This configuration setting is ignored if {@link #excludesList} is
* defined.
* A list of artifact patterns to exclude. Follows the pattern "groupId:artifactId:type:classifier:version". This
* configuration setting is ignored if {@link #excludesList} is defined.
*
* @parameter
* @since 1.0-beta-1
*/
private String[] excludes = null;

/**
* Whether to process the dependencies section of the project. If not
* set will default to true.
* Whether to process the dependencies section of the project. If not set will default to true.
*
* @parameter property="processDependencies" defaultValue="true"
* @since 1.0-alpha-3
*/
private Boolean processDependencies;

/**
* Whether to process the dependencyManagement section of the project. If not
* set will default to true.
* Whether to process the dependencyManagement section of the project. If not set will default to true.
*
* @parameter property="processDependencyManagement" defaultValue="true"
* @since 1.0-alpha-3
*/
private Boolean processDependencyManagement;

/**
* Whether to process the parent section of the project. If not set will default to false.
*
* @parameter property="processParent" defaultValue="false"
* @since 2.3
*/
private Boolean processParent = false;

/**
* Artifact filter to determine if artifact should be included
*
Expand Down Expand Up @@ -156,6 +160,18 @@ public boolean isProcessingDependencyManagement()
return !Boolean.FALSE.equals( processDependencyManagement );
}

/**
* Should the project/parent section of the pom be processed.
*
* @return returns <code>true if the project/parent section of the pom should be processed.
* @since 2.3
*/
public boolean isProcessingParent()
{
// true if true or null
return !Boolean.FALSE.equals( processParent );
}

/**
* Should the artifacts produced in the current reactor be excluded from processing.
*
Expand Down Expand Up @@ -269,11 +285,10 @@ protected boolean isProducedByReactor( Dependency dependency )
}

/**
* Compare a project to a dependency. Returns true only if the groupId and artifactId are all
* equal.
* Compare a project to a dependency. Returns true only if the groupId and artifactId are all equal.
*
* @param project the project
* @param dep the dependency
* @param dep the dependency
* @return true if project and dep refer to the same artifact
*/
private boolean compare( MavenProject project, Dependency dep )
Expand Down Expand Up @@ -383,8 +398,8 @@ else if ( excludes != null )
}

/**
* To handle multiple includes with version range like "group:artifact:jar:[1.0.0,2.2)",
* we have to use a parsing a little bit more complex than split().
* To handle multiple includes with version range like "group:artifact:jar:[1.0.0,2.2)", we have to use a parsing a
* little bit more complex than split().
*
* @param includeString the string to parse
* @return list of patterns
Expand Down
Loading

0 comments on commit 24450e8

Please sign in to comment.