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

released-version does not detect version if maven repository is not configured to look for snapshot #108

Closed
stefanseifert opened this issue Mar 2, 2021 · 0 comments

Comments

@stefanseifert
Copy link
Collaborator

We want to use build-helper:release-version to get the latest release of the artifact the plugin is defined in.
the artifact itself is currently using a SNAPSHOT version in the POM.

we use a minimal maven-settings.xml like this, defining only a single repository for lookup released version, but not snapshots:

<?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>

expected: detecting releases in this maven repo for the current module's artifact should work.

actual: it does not work, does not detect any released version (if there is also no released version in the local maven repo).

ArtifactMetadataSource.retrieveAvailableVersions does not find any released versions if the module it is executed on has a -SNAPSHOT version in the current POM.


workaround: if this part is removed from the repo definitions it's working - but then every snapshot request is also hitting the repo which is not intended:

<snapshots>
  <enabled>false</enabled>
</snapshots>
stefanseifert added a commit that referenced this issue Mar 2, 2021
…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
stefanseifert added a commit to wcm-io-devops/conga-aem-plugin that referenced this issue Mar 3, 2021
stefanseifert added a commit to wcm-io/wcm-io-tooling that referenced this issue Mar 3, 2021
stefanseifert added a commit to wcm-io/io.wcm.maven.archetypes.aem that referenced this issue Mar 3, 2021
stefanseifert added a commit to wcm-io/io.wcm.maven.archetypes.aem-confmgmt that referenced this issue Mar 3, 2021
stefanseifert added a commit to wcm-io/wcm-io-tooling that referenced this issue Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant