5 Replies Latest reply: Apr 22, 2012 8:53 AM by Alphonse Bendt RSS

can MavenDependencyResolver access password protected Repository?

Alphonse Bendt Newbie

Hi,

 

i'm trying to use Arquillian to run a test against a jboss as 7 container. the test should use an EAR file created by maven

 

 

 @Deployment(testable = false)
 public static EnterpriseArchive accessDeployment() {
   Collection<EnterpriseArchive> result = DependencyResolvers.use(MavenDependencyResolver.class).artifact("mygroupid:myartifact:ear:0.1-SNAPSHOT").resolveAs(EnterpriseArchive.class);
   EnterpriseArchive theEar = (EnterpriseArchive) result.toArray()[0];
   assertThat(theEar.getName(), containsString("myartifact"));

   return theEAR;
}

 

our maven repository is password protected. so i set up my settings.xml properly.

 

However running the test fails:

 

 

java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.EnterpriseArchive de.akquinet.ats.AccessServerTest.accessDeployment()
          at org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:160)
        [...]
Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Access denied to: https://myrepo/nexus/content/groups/request-repo/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.pom
          at org.apache.maven.wagon.providers.http.LightweightHttpWagon.resourceExists(LightweightHttpWagon.java:348)

 

It seems like the MavenDependencyResolver is not using the username/password from settings.xml correctly.

 

On my machine i could fix this by using the offline Mode:

 

@Deployment(testable = false)
 public static EnterpriseArchive accessDeployment() {
   Collection<EnterpriseArchive> result = DependencyResolvers.use(MavenDependencyResolver.class).artifact("mygroupid:myartifact:ear:0.1-SNAPSHOT").goOffline().resolveAs(EnterpriseArchive.class);

 

However this does not work on our jenkins CI server:

 

 

Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: The repository system is offline but the artifact mygroupid:myartifact-parent:pom:1.0.6-20120411.183852-5 is not available in the local repository.
 at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:499)
 at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:187)
 at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:115)
 ... 77 more

 

Should the MavenDependencyResolver be able to access password protected repositories?

if yes what am i doing wrong?

or is this a missing feature?

should i add a jira issue?

 

thanks for any advice,

  Alphonse Bendt