[
https://issues.jboss.org/browse/SHRINKRES-238?page=com.atlassian.jira.plu...
]
G. Richard Bellamy commented on SHRINKRES-238:
----------------------------------------------
[~mjobanek] - thanks for looking at this and figuring out what was happening!
To your first point - my best suggestion is to update the documentation and explicitly
warn about the Aether version issues when working with Shrinkwrap. I spent quite a bit of
time reading and trying to understand the best way to build out the dependencies, and both
Shrinkwrap and Arquillian docs seem to assume that dependencies will "just
work." Although, now that I know what to look for, I found an [SO
answer|http://stackoverflow.com/a/20257464/208939] in short order. Interestingly, that
answer is to deal with the other direction, where Wildfly is using a newer version than
Shrinkwrap. Either way, it's clearly been something other's have run into in the
past and I didn't see anything in the docs explicitly warning of the possibility.
As for your second comment - cuz I didn't know any better. :) Thanks for the
pointer!!!
Maven resolver always throws at with(out)Transitivity
-----------------------------------------------------
Key: SHRINKRES-238
URL:
https://issues.jboss.org/browse/SHRINKRES-238
Project: ShrinkWrap Resolvers
Issue Type: Bug
Components: maven-plugin
Affects Versions: 2.2.1, 2.2.2
Environment: Linux - Kernel 4.4.1
Mac OS X El Capitan - 10.11
Reporter: G. Richard Bellamy
When trying to build a Shrinkwrapped package using the Maven POM resolver, the
{{withoutTransitivity}} or {{withTransitivity}} method throws an
{{InvocationTargetException}} with the root being an {{AbstractMethodError}}.
{code:java|title=Java stanza that throws the exception}
PomEquippedResolveStage pomFromFile =
Maven.resolver().loadPomFromFile("pom.xml");
File[] files = pomFromFile
.importRuntimeDependencies()
.resolve()
.withoutTransitivity() // or .withTransitivity()
.asFile();
{code}
{noformat:title=Stacktrace}
java.lang.RuntimeException: Could not invoke deployment method: public static
org.jboss.shrinkwrap.api.Archive com.terradatum.TestMlsAreasBean.createDeployment()
at
org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:181)
at
org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generateDeployment(AnnotationDeploymentScenarioGenerator.java:103)
at
org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generate(AnnotationDeploymentScenarioGenerator.java:64)
at
org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at
org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
at
org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at
org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at
org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at
org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
at
org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:87)
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:201)
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:422)
at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54)
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:218)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:166)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at
org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:177)
... 56 more
Caused by: java.lang.AbstractMethodError
at
org.apache.maven.model.building.DefaultModelBuilder.configureResolver(DefaultModelBuilder.java:644)
at
org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:388)
at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:361)
at
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:217)
at
org.eclipse.aether.internal.impl.DefaultDependencyCollector.resolveCachedArtifactDescriptor(DefaultDependencyCollector.java:525)
at
org.eclipse.aether.internal.impl.DefaultDependencyCollector.getArtifactDescriptorResult(DefaultDependencyCollector.java:509)
at
org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:409)
at
org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:363)
at
org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:351)
at
org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:254)
at
org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:341)
at
org.jboss.shrinkwrap.resolver.impl.maven.bootstrap.MavenRepositorySystem.resolveDependencies(MavenRepositorySystem.java:121)
at
org.jboss.shrinkwrap.resolver.impl.maven.MavenWorkingSessionImpl.resolveDependencies(MavenWorkingSessionImpl.java:228)
at
org.jboss.shrinkwrap.resolver.impl.maven.MavenStrategyStageBaseImpl.using(MavenStrategyStageBaseImpl.java:71)
at
org.jboss.shrinkwrap.resolver.impl.maven.MavenStrategyStageBaseImpl.withoutTransitivity(MavenStrategyStageBaseImpl.java:58)
at
org.jboss.shrinkwrap.resolver.impl.maven.MavenStrategyStageBaseImpl.withoutTransitivity(MavenStrategyStageBaseImpl.java:40)
at com.terradatum.TestMlsAreasBean.createDeployment(TestMlsAreasBean.java:51)
... 61 more
{noformat}
When I step through the code, the ultimate failure is in
{{org.apache.maven.model.building.DefaultModelBuilder#configureResolver()}}:
{code:java|title=Java in the resolver where the problem presents}
private void configureResolver( ModelResolver modelResolver, Model model,
DefaultModelProblemCollector problems,
boolean replaceRepositories )
{
if ( modelResolver == null )
{
return;
}
problems.setSource( model );
List<Repository> repositories = model.getRepositories();
for ( Repository repository : repositories )
{
try
{
modelResolver.addRepository( repository, replaceRepositories );
}
catch ( InvalidRepositoryException e )
{
problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE
)
.setMessage( "Invalid repository " + repository.getId() +
": " + e.getMessage() )
.setLocation( repository.getLocation( "" ) )
.setException( e ) );
}
}
}
{code}
Specifically at line #14, where at {{modelResolver#addRepository()}} the exception is
thrown, seemingly out of nowhere. When viewed under the debugger, everything looks just
fine. As well, it's clearly the correct method signature (which is the first thought I
had since it's a {{AbstractMethodError}}), and I've checked the dependency chain
and runtime classpath and I can't find anything untoward.
This happens with the embedded IntelliJ IDEA 15 Maven (3.0.5) and my system's Maven
installation (3.3.9).
I should note that we use an internal Nexus server, and therefore have the following
{{settings.xml}}:
{code:xml|title=settings.xml}
<?xml version="1.0" encoding="UTF-8"?>
<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">
<mirrors>
<mirror>
<!-- This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<
url>https://nexus.INTERNAL.com/content/groups/public</url>
</mirror>
</mirrors>
<servers>
<server>
<id>releases</id>
<username>SOME-FANCY-USER</username>
<password>SOME-FANCY-PASSWORD</password>
</server>
<server>
<id>snapshots</id>
<username>SOME-FANCY-USER</username>
<password>SOME-FANCY-PASSWORD</password>
</server>
</servers>
<profiles>
<profile>
<id>nexus</id>
<!-- Enable snapshots for the built in central repo to direct -->
<!-- all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!-- make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
<pluginGroups>
<!-- define the sonatype plugin group, so the nexus plugins will work without
typing the groupId -->
<pluginGroup>org.sonatype.plugins</pluginGroup>
</pluginGroups>
</settings>
{code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)