Skip to content

[MNG-5984] Maven core extension resolution ignores repositories from activeByDefault profiles in settings.xml #7847

@jira-importer

Description

@jira-importer

Gabriël Konat opened MNG-5984 and commented

When building a project with a core extension in .mvn/extensions.xml, where the core extension is not installed locally but needs to be retrieved from a remote repository, profiles from settings.xml with repositories which are <activeByDefault>true</activeByDefault>, are ignored, failing the resolution of the core extension.

If the profile is activated from within an activeProfiles section, they are not ignored and resolution succeeds.

Concrete example:

<?xml version="1.0" encoding="UTF-8"?>
<extensions>
  <extension>
    <groupId>org.metaborg</groupId>
    <artifactId>spoofax-maven-plugin-pomless</artifactId>
    <version>2.0.0-SNAPSHOT</version>
  </extension>
</extensions>
<?xml version="1.0" ?>
<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>add-metaborg-snapshot-repos</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>metaborg-snapshot-repo</id>
          <url>http://artifacts.metaborg.org/content/repositories/snapshots/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>metaborg-snapshot-repo</id>
          <url>http://artifacts.metaborg.org/content/repositories/snapshots/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
</settings>

Results in failed resolution:

[WARNING] The POM for org.metaborg:spoofax-maven-plugin-pomless:jar:2.0.0-SNAPSHOT is missing, no dependency information available
[WARNING] Failed to read extensions descriptor /Users/gohla/spoofax/master/repo/spoofax-releng/sdf/org.metaborg.meta.lang.sdf/.mvn/extensions.xml: Plugin org.metaborg:spoofax-maven-plugin-pomless:2.0.0-SNAPSHOT or one of its dependencies could not be resolved: Could not find artifact org.metaborg:spoofax-maven-plugin-pomless:jar:2.0.0-SNAPSHOT

Whereas with the following settings file it succeeds to resolve the core extension:

<?xml version="1.0" ?>
<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>add-metaborg-snapshot-repos</id>
      <repositories>
        <repository>
          <id>metaborg-snapshot-repo</id>
          <url>http://artifacts.metaborg.org/content/repositories/snapshots/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>metaborg-snapshot-repo</id>
          <url>http://artifacts.metaborg.org/content/repositories/snapshots/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>add-metaborg-snapshot-repos</activeProfile>
  </activeProfiles>
</settings>

Affects: 3.3.9

Issue Links:

  • MNG-7115 MavenITmng5771CoreExtensionsTest fails on maven-3.8.x branch

  • MNG-6327 Add ability to easily retrieve core extensions from alternative pluginRepository

  • MNG-7018 Maven does not traverse all repos when downloading extensions from .mvn/extensions.xml

Remote Links:

1 votes, 12 watchers

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:minorMinor loss of function, or other problem where easy workaround is present

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions