eclipse-m2e / m2e-core

Eclipse Public License 2.0
113 stars 116 forks source link

Force update when resolving maven target #1830

Open Bananeweizen opened 2 months ago

Bananeweizen commented 2 months ago

I've just got a "This failure was cached in the local repository ...until forced" error message when resolving a target platform with contained maven artifacts. On the command line, I would use -U to force the update. During target platform resolution there is no such option. Would it be possible to hardcode the forced update for every target platform resolution maybe?

  ERROR: org.eclipse.pde.core code=0 Problems occurred while resolving the target contents
    ERROR: org.eclipse.m2e.core code=-1 Could not resolve artifact org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server:jar:12.0.13
      ERROR: org.eclipse.m2e.core code=0 org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server:jar:12.0.13 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server:jar:12.0.13 from/to central (https://repo.maven.apache.org/maven2): Connect to localhost:3128 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: getsockopt
      org.eclipse.aether.transfer.ArtifactTransferException: org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server:jar:12.0.13 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.eclipse.jetty.ee10.websocket:jetty-ee10-websocket-jetty-server:jar:12.0.13 from/to central (https://repo.maven.apache.org/maven2): Connect to localhost:3128 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: getsockopt
        at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:235)
        at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:201)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:586)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:525)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:449)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:261)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:243)
        at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:278)
        at org.eclipse.m2e.core.internal.embedder.MavenImpl.lambda$7(MavenImpl.java:518)
        at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:458)
        at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:339)
        at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:278)
        at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:509)
        at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:494)
        at org.eclipse.m2e.pde.target.MavenTargetLocation.resolveDependency(MavenTargetLocation.java:239)
        at org.eclipse.m2e.pde.target.MavenTargetLocation.resolveArtifacts(MavenTargetLocation.java:170)
        at org.eclipse.m2e.pde.target.MavenTargetLocation.resolveBundles(MavenTargetLocation.java:157)
        at org.eclipse.pde.internal.core.target.AbstractBundleContainer.resolve(AbstractBundleContainer.java:97)
        at org.eclipse.pde.internal.core.target.TargetDefinition.resolve(TargetDefinition.java:386)
laeubi commented 2 months ago

Yes that's very annoying maven behavior, maybe always use force has bad impact on performance, but there is a "refresh" button in the target editor, currently m2e only throws away the resolved result, but maybe we should add a flag to use the force update snapshots option in this case. DO you like to look into this an propose a PR?