wildfly-extras / prospero

Prospero is a tool combining Galleon feature packs and wildfly-channels to provision and update Wildfly server.
Apache License 2.0
9 stars 24 forks source link

Failed to get `maven-metadata.xml` file #698

Closed jamezp closed 1 week ago

jamezp commented 2 weeks ago

I'm attempting to execute the following command:

prospero.sh install -vv --channels=dev.resteasy.channels:resteasy-6.2,org.wildfly:wildfly --dir=wildfly --fpl=org.wildfly:wildfly-galleon-pack --use-default-local-cache

However, the dev.resteasy.channels:resteasy-6.2/maven-metadata.xml cannot be found by the dependency resolution. The file does exist though, https://repo1.maven.org/maven2/dev/resteasy/channels/resteasy-6.2/maven-metadata.xml. Below is the error I'm seeing:

org.wildfly.channel.ArtifactTransferException: dev.resteasy.channels:resteasy-6.2/maven-metadata.xml failed to transfer from https://repo1.maven.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata dev.resteasy.channels:resteasy-6.2/maven-metadata.xml from/to central (https://repo1.maven.org/maven2): Cannot access https://repo1.maven.org/maven2 with type  using the available connector factories: BasicRepositoryConnectorFactory
    at org.jboss.prospero//org.wildfly.channel.maven.RetryHandler$RetryCounter.addRetry(RetryHandler.java:144)
    at org.jboss.prospero//org.wildfly.channel.maven.RetryHandler.attemptResolveMetadata(RetryHandler.java:109)
    at org.jboss.prospero//org.wildfly.channel.maven.VersionResolverFactory$MavenResolverImpl.getAllVersions(VersionResolverFactory.java:153)
    at org.jboss.prospero//org.wildfly.channel.maven.VersionResolverFactory$MavenResolverImpl.resolveChannelMetadata(VersionResolverFactory.java:238)
    at org.jboss.prospero//org.wildfly.channel.maven.VersionResolverFactory.resolveChannels(VersionResolverFactory.java:340)
    at org.jboss.prospero//org.wildfly.prospero.api.ProvisioningDefinition.resolveChannels(ProvisioningDefinition.java:177)
    at org.jboss.prospero//org.wildfly.prospero.cli.commands.AbstractInstallCommand.resolveChannels(AbstractInstallCommand.java:93)
    at org.jboss.prospero//org.wildfly.prospero.cli.commands.InstallCommand.call(InstallCommand.java:149)
    at org.jboss.prospero//org.wildfly.prospero.cli.commands.InstallCommand.call(InstallCommand.java:50)
    at org.jboss.prospero//picocli.CommandLine.executeUserObject(CommandLine.java:2041)
    at org.jboss.prospero//picocli.CommandLine.access$1500(CommandLine.java:148)
    at org.jboss.prospero//picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
    at org.jboss.prospero//picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
    at org.jboss.prospero//picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
    at org.jboss.prospero//picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
    at org.jboss.prospero//picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
    at org.jboss.prospero//picocli.CommandLine.execute(CommandLine.java:2170)
    at org.jboss.prospero//org.wildfly.prospero.cli.CliMain.execute(CliMain.java:132)
    at org.jboss.prospero//org.wildfly.prospero.cli.CliMain.main(CliMain.java:60)
    at org.jboss.modules.Module.run(Module.java:352)
    at org.jboss.modules.Module.run(Module.java:320)
    at org.jboss.modules.Main.main(Main.java:607)
Caused by: org.eclipse.aether.transfer.MetadataTransferException: dev.resteasy.channels:resteasy-6.2/maven-metadata.xml failed to transfer from https://repo1.maven.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata dev.resteasy.channels:resteasy-6.2/maven-metadata.xml from/to central (https://repo1.maven.org/maven2): Cannot access https://repo1.maven.org/maven2 with type  using the available connector factories: BasicRepositoryConnectorFactory
    at org.jboss.prospero//org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:331)
    at org.jboss.prospero//org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkMetadata(DefaultUpdateCheckManager.java:293)
    at org.jboss.prospero//org.eclipse.aether.internal.impl.DefaultMetadataResolver.resolve(DefaultMetadataResolver.java:303)
    at org.jboss.prospero//org.eclipse.aether.internal.impl.DefaultMetadataResolver.resolveMetadata(DefaultMetadataResolver.java:180)
    at org.jboss.prospero//org.apache.maven.repository.internal.DefaultVersionRangeResolver.getVersions(DefaultVersionRangeResolver.java:198)
    at org.jboss.prospero//org.apache.maven.repository.internal.DefaultVersionRangeResolver.resolveVersionRange(DefaultVersionRangeResolver.java:148)
    at org.jboss.prospero//org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveVersionRange(DefaultRepositorySystem.java:260)
    at org.jboss.prospero//org.wildfly.channel.maven.VersionResolverFactory$MavenResolverImpl.lambda$getAllVersions$0(VersionResolverFactory.java:155)
    at org.jboss.prospero//org.wildfly.channel.maven.RetryHandler.attemptResolveMetadata(RetryHandler.java:96)
    ... 20 more

The ~/.m2/repository/dev/resteasy/channels/resteasy-6.2/resolver-status.properties contains the following:

#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Fri Jun 21 10:15:38 PDT 2024
maven-metadata-central.xml.error=Could not transfer metadata dev.resteasy.channels\:resteasy-6.2/maven-metadata.xml from/to central (https\://repo1.maven.org/maven2)\: Cannot access https\://repo1.maven.org/maven2 with type  using the available connector factories\: BasicRepositoryConnectorFactory
maven-metadata-central.xml/@-central-https\://repo1.maven.org/maven2/.lastUpdated=1718990095779

I'm not too sure what the issue could be.

spyrkob commented 1 week ago

@jamezp thanks for the report, there's two issues here: 1) a bug fixed in #703, and 2) there are no channels published at the GAVs you're using, only manifests (channel artifact would have a channel classifier).

I think what you're trying to achieve is:

echo '---
schemaVersion: "2.0.0"
name: "wildfly"
repositories:
  - id: "central"
    url: "https://repo1.maven.org/maven2/"
  - id: "jboss-public"
    url: "https://repository.jboss.org/nexus/content/groups/public/"
  - id: "mrrc"
    url: "https://maven.repository.redhat.com/ga/"
manifest:
  maven:
    groupId: "org.wildfly.channels"
    artifactId: "wildfly"
---
schemaVersion: "2.0.0"
name: "resteasy"
repositories:
  - id: "central"
    url: "https://repo1.maven.org/maven2/"
manifest:
  maven:
    groupId: "dev.resteasy.channels"
    artifactId: "resteasy-6.2"' > resteasy-channel.yaml

prospero.sh install --channels resteasy-channel.yaml --dir test-wfly --fpl org.wildfly:wildfly-galleon-pack 

Unfortunately since this requires two channels, it's not possible to execute it as a oneliner with --manifest and --repositories

jamezp commented 1 week ago

Thank you @spyrkob. I was wondering if it was a missing channel issue. Would it make sense for manifests which just want to override the version of provisioned dependencies to also create a channel? I don't think there is much effort in doing this, but I want to make sure it also won't make a mess of things.

IoW, in this specific case should RESTEasy also create a channel that gets published?

spyrkob commented 1 week ago

Would it make sense for manifests which just want to override the version of provisioned dependencies to also create a channel?

Yes, each channel is tied to a single manifest so an overwrite manifest has to come with it's own channel. Note it's possible to define a dependency on another channel (see requires field in manifest definition). Using this the WildFly channel would be created based on repositories defined in the RESTEasy channel and the required manifest.

IoW, in this specific case should RESTEasy also create a channel that gets published?

I'd say if you feel like this would make it easier to consume the manifest, than sure. So far we haven't been publishing channel definitions for any other projects, but we're really only starting with them in WildFly :)