takari / takari-plugin-testing-project

Maven Plugin Testing Framework
Eclipse Public License 1.0
27 stars 19 forks source link

Dealing with repository mirror requiring credentials #27

Open ginkel opened 4 years ago

ginkel commented 4 years ago

Hi there,

I am trying to get integration testing working as outlined in the README.

@RunWith(MavenJUnitTestRunner.class)
@MavenVersions({"3.6.3"})
class CobolCopyToJavaMojoTest {

  @Rule
  public final TestResources resources = new TestResources();

  public final MavenRuntime maven;

  public CobolCopyToJavaMojoTest(MavenRuntimeBuilder mavenBuilder) throws Exception {
    this.maven = mavenBuilder.withCliOptions("-B", "-U").build();
  }

  @Test
  void test() {
    [...]
  }
}

Unfortunately, this does not seem to work when there is a mirror configured that needs credentials:

java.lang.Exception: Could not resolve maven version 3.6.3

    at io.takari.maven.testing.executor.junit.MavenJUnitTestRunner$1.error(MavenJUnitTestRunner.java:129)
    at io.takari.maven.testing.executor.junit.MavenVersionResolver.resolve(MavenVersionResolver.java:105)
    at io.takari.maven.testing.executor.junit.MavenJUnitTestRunner.getRunners(MavenJUnitTestRunner.java:131)
    at io.takari.maven.testing.executor.junit.MavenJUnitTestRunner.<init>(MavenJUnitTestRunner.java:89)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
    at org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
    at org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:50)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)
Caused by: java.io.FileNotFoundException: Could not download maven version 3.6.3 from any configured repository
    at io.takari.maven.testing.executor.junit.MavenVersionResolver.createMavenInstallation(MavenVersionResolver.java:272)
    at io.takari.maven.testing.executor.junit.MavenVersionResolver.resolve(MavenVersionResolver.java:103)
    ... 18 more
Caused by: java.io.IOException: HTTP/401 Unauthorized
    at io.takari.maven.testing.executor.junit.MavenVersionResolver.openStream(MavenVersionResolver.java:314)
    at io.takari.maven.testing.executor.junit.MavenVersionResolver.createMavenInstallation(MavenVersionResolver.java:255)
    ... 19 more

Any ideas?

TobiX commented 2 years ago

You are probably hit by a similar issue as #17