Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ITs for set goal #1107

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 4 additions & 82 deletions versions-maven-plugin/src/it/it-set-001-issue-76/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<version>1.0</version>
<packaging>pom</packaging>
<name>set IT for issue-85</name>
<url>
https://github.com/mojohaus/versions/issues/76
https://github.com/mojohaus/versions/issues/85
</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -19,87 +23,5 @@
<version>2.2</version>
</dependency>
</dependencies>
<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>
57 changes: 4 additions & 53 deletions versions-maven-plugin/src/it/it-set-001-issue-76/verify.groovy
Original file line number Diff line number Diff line change
@@ -1,54 +1,5 @@
import java.io.*;
import org.codehaus.plexus.util.FileUtils;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.model.Model;
import org.apache.maven.model.Dependency;
import java.util.List;
import groovy.xml.XmlSlurper


boolean test()
{
result = true;
try
{
parentPomFile = new File( basedir, "pom.xml" );
pomReader = new MavenXpp3Reader();
pomModel = pomReader.read( new InputStreamReader( new FileInputStream( parentPomFile ) ) );

result = result && verifyThatDependencyHasNotBeenChanged( pomModel.getDependencies() );
result = result && verifyThatTheProjectVerisonHasBeenChanged( pomModel );

}
catch( Throwable t )
{
t.printStackTrace();
return false;
}

return result;
}


// == Support functions ===
boolean verifyThatTheProjectVerisonHasBeenChanged( model ) {

if ( !"2.3".equals(model.getVersion()) )
{
System.err.println("Model version not been changed " + model.getId() );
return false;
}
return true;
}

boolean verifyThatDependencyHasNotBeenChanged( dependencies ) {

Dependency dep = dependencies.get(0)
if ( !"2.2".equals(dep.getVersion()) )
{
System.err.println("Dependency has been changed " + dep.getId() );
return false;
}
return true;
}

return test();
def project = new XmlSlurper().parse(new File(basedir, 'pom.xml'))
assert project.version == '2.3'
assert project.dependencies.dependency[0].version == '2.2'
5 changes: 1 addition & 4 deletions versions-maven-plugin/src/it/it-set-001/invoker.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
invoker.goals.1=${project.groupId}:${project.artifactId}:${project.version}:set -DnewVersion=2.0
invoker.nonRecursive.1=true
invoker.buildResult.1=success

invoker.goals.2=${project.groupId}:${project.artifactId}:${project.version}:set -DnewVersion=2.0 -DgroupId=* -DartifactId=* -DoldVersion=*
invoker.nonRecursive.2=true
invoker.buildResult.2=success
invoker.description.2=Test the set mojo when the new version is the same as the old version, using wildcards. This kind of build used to fail accourding the issue 83 from github.
invoker.buildResult.2=success
87 changes: 5 additions & 82 deletions versions-maven-plugin/src/it/it-set-001/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,87 +8,10 @@
<packaging>pom</packaging>
<name>set</name>

<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>
<url>https://github.com/mojohaus/versions/issues/83</url>

<description>
Test the set mojo when the new version is the same as the old version, using wildcards.
This kind of build used to fail according the issue 83 from GitHub.
</description>
</project>
32 changes: 0 additions & 32 deletions versions-maven-plugin/src/it/it-set-001/verify.bsh

This file was deleted.

4 changes: 4 additions & 0 deletions versions-maven-plugin/src/it/it-set-001/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import groovy.xml.XmlSlurper

def project = new XmlSlurper().parse(new File(basedir, 'pom.xml'))
assert project.version == '2.0'
1 change: 0 additions & 1 deletion versions-maven-plugin/src/it/it-set-002/invoker.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:set -DnewVersion=2.0
invoker.nonRecursive=true
invoker.buildResult=success
83 changes: 0 additions & 83 deletions versions-maven-plugin/src/it/it-set-002/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,87 +14,4 @@
<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>
Loading