Bug 1008538

Summary: Cannot find maven dependency when flagged as provided
Product: [Retired] JBoss BRMS Platform 6 Reporter: Mario Fusco <mfusco>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED DUPLICATE QA Contact: Lukáš Petrovický <lpetrovi>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0.0   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-08 11:02:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test project none

Description Mario Fusco 2013-09-16 14:49:51 UTC
Created attachment 798305 [details]
Test project

Extracting the provided test project and running mvn install on it produces the console output pasted below.

This happens when for a dependency the scope is
- set to 'provided' and
- a parameter (in the case ${jbpm.version}) is used in the version field.

So the relevant entry in the pom is:

<dependency>
       <groupId>org.drools</groupId>
       <artifactId>drools-core</artifactId>
       <version>${drools.version}</version>
       <scope>provided</scope>
     </dependency>

which leads to

11:15:02,584  WARN Dependency artifact not found for:
org.jbpm:jbpm-bpmn2:${jbpm.version}

and then the NPE. I'm guessing the parameter is not being resolved.

1. it probably should resolve parameters
2. if a dependency is scoped as 'provided' I think it is supposed to
locate it on the classpath and NOT from maven. However I'm not sure this
is the way that works in testing anyway.
3. if the dependency  cannot be found it should probably stop and not
even proceed rather then warn?
4. it should be interesting to see why it gets the NPE.

If you change the dependency from 'provided' to 'test' things work fine.

Console output:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/Users/kstam/.m2/repository/org/slf4j/slf4j-log4j12/1.5.11/slf4j-log4j12-1.5.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/Users/kstam/.m2/repository/org/slf4j/slf4j-nop/1.5.11/slf4j-nop-1.5.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
Reading your .m2 repo
11:14:24,013  INFO Number of application's worked threads is 16
artifact=org.overlord.dtgovtgov-workflows:jar:2.0.2-SNAPSHOT
11:14:54,508  INFO Number of application's worked threads is 16
11:14:55,945  INFO Number of application's worked threads is 16
11:15:01,804  INFO Number of application's worked threads is 16
11:15:02,034  INFO Number of application's worked threads is 16
11:15:02,584  WARN Dependency artifact not found for:
org.jbpm:jbpm-bpmn2:${jbpm.version}
java.lang.NullPointerException
     at sun.net.util.URLUtil.urlNoFragString(URLUtil.java:29)
     at sun.misc.URLClassPath.getLoader(URLClassPath.java:296)
     at sun.misc.URLClassPath.access$000(URLClassPath.java:60)
     at sun.misc.URLClassPath$1.next(URLClassPath.java:199)
     at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:210)
     at java.net.URLClassLoader$3$1.run(URLClassLoader.java:416)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader$3.next(URLClassLoader.java:413)
     at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:438)
     at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)
     at
sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)
     at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)
     at
sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)
     at
org.kie.internal.utils.ChainedProperties.loadProperties(ChainedProperties.java:240)
     at
org.kie.internal.utils.ChainedProperties.<init>(ChainedProperties.java:92)
     at
org.drools.compiler.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:201)
     at
org.drools.compiler.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:196)
     at
org.drools.compiler.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:152)
     at
org.drools.compiler.kie.builder.impl.AbstractKieModule.buildKnowledgePackages(AbstractKieModule.java:167)
     at
org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:39)
     at
org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieModule(KieBuilderImpl.java:297)
     at
org.kie.scanner.KieRepositoryScannerImpl.build(KieRepositoryScannerImpl.java:152)
     at
org.kie.scanner.KieRepositoryScannerImpl.buildArtifact(KieRepositoryScannerImpl.java:107)
     at
org.kie.scanner.KieRepositoryScannerImpl.loadArtifact(KieRepositoryScannerImpl.java:88)
     at
org.kie.scanner.KieRepositoryScannerImpl.loadArtifact(KieRepositoryScannerImpl.java:81)
     at
org.drools.compiler.kie.builder.impl.KieRepositoryImpl.loadKieModuleFromMavenRepo(KieRepositoryImpl.java:104)
     at
org.drools.compiler.kie.builder.impl.KieRepositoryImpl.getKieModule(KieRepositoryImpl.java:90)
     at
org.drools.compiler.kie.builder.impl.KieRepositoryImpl.getKieModule(KieRepositoryImpl.java:71)
     at
org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:82)
     at org.overlord.dtgov.jbpm.util.KieTest.testKieJar(KieTest.java:87)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
     at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
     at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
     at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
     at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
     at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
     at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
     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.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
     at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
     at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
     at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
     at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
     at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Comment 5 Mario Fusco 2013-10-08 11:02:03 UTC

*** This bug has been marked as a duplicate of bug 1014157 ***