-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #108 - released-version does not detect version if maven reposi…
…tory is not configured to look for snapshot add integration test "released-version-existing-asset" covering existing functionality to get released version for a artifact from maven central add integration test to cover the fix for #108 update to mojo-parent 61 as we need a newer version of maven-invoker-plugin that supports the invoker.settingsFile property
- Loading branch information
1 parent
a17e31e
commit b6a7a02
Showing
10 changed files
with
245 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/it/released-version-existing-asset-issue-108/invoker.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
invoker.goals = test | ||
invoker.buildResult = success | ||
invoker.settingsFile = src/it/released-version-existing-asset-issue-108/settings-maven-central-no-snapshot.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<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> | ||
|
||
<!-- | ||
We use by intention an existing artifact here, an artifact that exists in maven central to detect it's released version | ||
And we are using an external quite specific and outdated asset, that is definitly already in the local maven repo | ||
(because if it is in the local maven repo the test will pass always, and Issue #108 cannot be really tested) | ||
--> | ||
<groupId>org.apache.continuum</groupId> | ||
<artifactId>continuum</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>build-helper-maven-plugin-released-version-it</name> | ||
|
||
<build> | ||
<defaultGoal>package</defaultGoal> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<id>released-version</id> | ||
<goals> | ||
<goal>released-version</goal> | ||
</goals> | ||
<configuration> | ||
<propertyPrefix>myReleasedVersion</propertyPrefix> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-antrun-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>mk-target-dir</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
<configuration> | ||
<tasks> | ||
<mkdir dir="${project.build.directory}" /> | ||
</tasks> | ||
</configuration> | ||
</execution> | ||
|
||
<execution> | ||
<id>echo-released-version</id> | ||
<phase>test</phase> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
<configuration> | ||
<tasks> | ||
<echo>myReleasedVersion.version=${myReleasedVersion.version}</echo> | ||
<echo>myReleasedVersion.majorVersion=${myReleasedVersion.majorVersion}</echo> | ||
<echo>myReleasedVersion.minorVersion=${myReleasedVersion.minorVersion}</echo> | ||
<echo>myReleasedVersion.incrementalVersion=${myReleasedVersion.incrementalVersion}</echo> | ||
</tasks> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
41 changes: 41 additions & 0 deletions
41
src/it/released-version-existing-asset-issue-108/settings-maven-central-no-snapshot.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> | ||
<profiles> | ||
<profile> | ||
<id>default</id> | ||
<repositories> | ||
<repository> | ||
<id>central</id> | ||
<url>https://repo1.maven.org/maven2/</url> | ||
<layout>default</layout> | ||
<releases> | ||
<enabled>true</enabled> | ||
<updatePolicy>never</updatePolicy> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>central</id> | ||
<url>https://repo1.maven.org/maven2/</url> | ||
<layout>default</layout> | ||
<releases> | ||
<enabled>true</enabled> | ||
<updatePolicy>never</updatePolicy> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
</profile> | ||
</profiles> | ||
<activeProfiles> | ||
<activeProfile>default</activeProfile> | ||
</activeProfiles> | ||
</settings> |
12 changes: 12 additions & 0 deletions
12
src/it/released-version-existing-asset-issue-108/verify.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
File file = new File( basedir, "build.log" ); | ||
assert file.exists(); | ||
|
||
String text = file.getText("utf-8"); | ||
|
||
// assert latest release of org.apache.continuum:continuum - it's in apache attic, there will be no new releases any more | ||
assert text.contains("myReleasedVersion.version=1.4.2") | ||
assert text.contains("myReleasedVersion.majorVersion=1") | ||
assert text.contains("myReleasedVersion.minorVersion=4") | ||
assert text.contains("myReleasedVersion.incrementalVersion=2") | ||
|
||
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
invoker.goals = test | ||
invoker.buildResult = success | ||
invoker.settingsFile = src/it/released-version-existing-asset/settings-maven-central.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<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> | ||
|
||
<!-- | ||
We use by intention an existing artifact here, an artifact that exists in maven central to detect it's released version | ||
--> | ||
<groupId>org.apache.continuum</groupId> | ||
<artifactId>continuum</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>build-helper-maven-plugin-released-version-it-mojo-parent</name> | ||
|
||
<build> | ||
<defaultGoal>package</defaultGoal> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<id>released-version</id> | ||
<goals> | ||
<goal>released-version</goal> | ||
</goals> | ||
<configuration> | ||
<propertyPrefix>myReleasedVersion</propertyPrefix> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-antrun-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>mk-target-dir</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
<configuration> | ||
<tasks> | ||
<mkdir dir="${project.build.directory}" /> | ||
</tasks> | ||
</configuration> | ||
</execution> | ||
|
||
<execution> | ||
<id>echo-released-version</id> | ||
<phase>test</phase> | ||
<goals> | ||
<goal>run</goal> | ||
</goals> | ||
<configuration> | ||
<tasks> | ||
<echo>myReleasedVersion.version=${myReleasedVersion.version}</echo> | ||
<echo>myReleasedVersion.majorVersion=${myReleasedVersion.majorVersion}</echo> | ||
<echo>myReleasedVersion.minorVersion=${myReleasedVersion.minorVersion}</echo> | ||
<echo>myReleasedVersion.incrementalVersion=${myReleasedVersion.incrementalVersion}</echo> | ||
</tasks> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
27 changes: 27 additions & 0 deletions
27
src/it/released-version-existing-asset/settings-maven-central.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> | ||
<profiles> | ||
<profile> | ||
<id>default</id> | ||
<repositories> | ||
<repository> | ||
<id>central</id> | ||
<url>https://repo1.maven.org/maven2/</url> | ||
<layout>default</layout> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>central</id> | ||
<url>https://repo1.maven.org/maven2/</url> | ||
<layout>default</layout> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
</profile> | ||
</profiles> | ||
<activeProfiles> | ||
<activeProfile>default</activeProfile> | ||
</activeProfiles> | ||
</settings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
File file = new File( basedir, "build.log" ); | ||
assert file.exists(); | ||
|
||
String text = file.getText("utf-8"); | ||
|
||
// assert latest release of org.apache.continuum:continuum - it's in apache attic, there will be no new releases any more | ||
assert text.contains("myReleasedVersion.version=1.4.2") | ||
assert text.contains("myReleasedVersion.majorVersion=1") | ||
assert text.contains("myReleasedVersion.minorVersion=4") | ||
assert text.contains("myReleasedVersion.incrementalVersion=2") | ||
|
||
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters