diff --git a/pom.xml b/pom.xml
index dca1c95c..0f78d634 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.codehaus.mojo
mojo-parent
- 50
+ 61
build-helper-maven-plugin
diff --git a/src/it/released-version-existing-asset-issue-108/invoker.properties b/src/it/released-version-existing-asset-issue-108/invoker.properties
new file mode 100644
index 00000000..9d52a08e
--- /dev/null
+++ b/src/it/released-version-existing-asset-issue-108/invoker.properties
@@ -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
diff --git a/src/it/released-version-existing-asset-issue-108/pom.xml b/src/it/released-version-existing-asset-issue-108/pom.xml
new file mode 100644
index 00000000..2ed8aa89
--- /dev/null
+++ b/src/it/released-version-existing-asset-issue-108/pom.xml
@@ -0,0 +1,69 @@
+
+ 4.0.0
+
+
+ org.apache.continuum
+ continuum
+ 1.0-SNAPSHOT
+ build-helper-maven-plugin-released-version-it
+
+
+ package
+
+
+ @project.groupId@
+ @project.artifactId@
+ @project.version@
+
+
+ released-version
+
+ released-version
+
+
+ myReleasedVersion
+
+
+
+
+
+ maven-antrun-plugin
+
+
+ mk-target-dir
+ compile
+
+ run
+
+
+
+
+
+
+
+
+
+ echo-released-version
+ test
+
+ run
+
+
+
+ myReleasedVersion.version=${myReleasedVersion.version}
+ myReleasedVersion.majorVersion=${myReleasedVersion.majorVersion}
+ myReleasedVersion.minorVersion=${myReleasedVersion.minorVersion}
+ myReleasedVersion.incrementalVersion=${myReleasedVersion.incrementalVersion}
+
+
+
+
+
+
+
+
+
diff --git a/src/it/released-version-existing-asset-issue-108/settings-maven-central-no-snapshot.xml b/src/it/released-version-existing-asset-issue-108/settings-maven-central-no-snapshot.xml
new file mode 100644
index 00000000..051c5889
--- /dev/null
+++ b/src/it/released-version-existing-asset-issue-108/settings-maven-central-no-snapshot.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ default
+
+
+ central
+ https://repo1.maven.org/maven2/
+ default
+
+ true
+ never
+
+
+ false
+
+
+
+
+
+ central
+ https://repo1.maven.org/maven2/
+ default
+
+ true
+ never
+
+
+ false
+
+
+
+
+
+
+ default
+
+
diff --git a/src/it/released-version-existing-asset-issue-108/verify.groovy b/src/it/released-version-existing-asset-issue-108/verify.groovy
new file mode 100644
index 00000000..c792a03a
--- /dev/null
+++ b/src/it/released-version-existing-asset-issue-108/verify.groovy
@@ -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;
diff --git a/src/it/released-version-existing-asset/invoker.properties b/src/it/released-version-existing-asset/invoker.properties
new file mode 100644
index 00000000..a48f6073
--- /dev/null
+++ b/src/it/released-version-existing-asset/invoker.properties
@@ -0,0 +1,3 @@
+invoker.goals = test
+invoker.buildResult = success
+invoker.settingsFile = src/it/released-version-existing-asset/settings-maven-central.xml
diff --git a/src/it/released-version-existing-asset/pom.xml b/src/it/released-version-existing-asset/pom.xml
new file mode 100644
index 00000000..83dab0a0
--- /dev/null
+++ b/src/it/released-version-existing-asset/pom.xml
@@ -0,0 +1,67 @@
+
+ 4.0.0
+
+
+ org.apache.continuum
+ continuum
+ 1.0-SNAPSHOT
+ build-helper-maven-plugin-released-version-it-mojo-parent
+
+
+ package
+
+
+ @project.groupId@
+ @project.artifactId@
+ @project.version@
+
+
+ released-version
+
+ released-version
+
+
+ myReleasedVersion
+
+
+
+
+
+ maven-antrun-plugin
+
+
+ mk-target-dir
+ compile
+
+ run
+
+
+
+
+
+
+
+
+
+ echo-released-version
+ test
+
+ run
+
+
+
+ myReleasedVersion.version=${myReleasedVersion.version}
+ myReleasedVersion.majorVersion=${myReleasedVersion.majorVersion}
+ myReleasedVersion.minorVersion=${myReleasedVersion.minorVersion}
+ myReleasedVersion.incrementalVersion=${myReleasedVersion.incrementalVersion}
+
+
+
+
+
+
+
+
+
diff --git a/src/it/released-version-existing-asset/settings-maven-central.xml b/src/it/released-version-existing-asset/settings-maven-central.xml
new file mode 100644
index 00000000..e112181a
--- /dev/null
+++ b/src/it/released-version-existing-asset/settings-maven-central.xml
@@ -0,0 +1,27 @@
+
+
+
+
+ default
+
+
+ central
+ https://repo1.maven.org/maven2/
+ default
+
+
+
+
+ central
+ https://repo1.maven.org/maven2/
+ default
+
+
+
+
+
+ default
+
+
diff --git a/src/it/released-version-existing-asset/verify.groovy b/src/it/released-version-existing-asset/verify.groovy
new file mode 100644
index 00000000..c792a03a
--- /dev/null
+++ b/src/it/released-version-existing-asset/verify.groovy
@@ -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;
diff --git a/src/main/java/org/codehaus/mojo/buildhelper/ReleasedVersionMojo.java b/src/main/java/org/codehaus/mojo/buildhelper/ReleasedVersionMojo.java
index c6f11ef2..77d3c7fa 100644
--- a/src/main/java/org/codehaus/mojo/buildhelper/ReleasedVersionMojo.java
+++ b/src/main/java/org/codehaus/mojo/buildhelper/ReleasedVersionMojo.java
@@ -92,8 +92,17 @@ private void defineVersionProperty( String name, int value )
@SuppressWarnings( "unchecked" )
public void execute()
{
+ /*
+ * We use a dummy version "0" here to check for all released version.
+ * Reason: The current project's version is completely irrelevant for the check to retrieve all available versions.
+ * But if the current project's version is a -SNAPSHOT version, only repository from maven settings are
+ * requested that are allowed for snapshots - but we want to query for released versions, not for snapshots.
+ * Using the dummy version "0" which looks like a released version, the repos with releases are requested.
+ * see https://github.com/mojohaus/build-helper-maven-plugin/issues/108
+ */
+ final String DUMMY_VERSION = "0";
org.apache.maven.artifact.Artifact artifact =
- artifactFactory.createArtifact( getProject().getGroupId(), getProject().getArtifactId(), getProject().getVersion(), "", "" );
+ artifactFactory.createArtifact( getProject().getGroupId(), getProject().getArtifactId(), DUMMY_VERSION, "", "" );
try
{
ArtifactVersion releasedVersion = null;