Dependency jar is excluded during mvn clean install build

asked 2015-04-17 02:50:24 -0700

Hariharan_Sethuraman gravatar image

Hi,

I am writing some unit test where I use mockito framework to mock few scenarios. During mvn clean install, it fails stating org.mockito couldnt be resolved.

Here are my data points:

I have added the following dependency in my pom.xml

diff --git a/persistence-hbase/pom.xml b/persistence-hbase/pom.xml index f118535..903a5c6 100644 --- a/persistence-hbase/pom.xml +++ b/persistence-hbase/pom.xml @@ -39,5 +39,11 @@ < artifactId>tsdr-persistence-spi < version>${tsdr.project.version} < /dependency> + < dependency> + < groupId>org.mockito + < artifactId>mockito-all + < version>1.9.5 + < scope>test + < /dependency> < /dependencies> < /project> (Just added space between the < and element so that the xml is displayed properly without ignoring the xml elements)

Here is my mockito jar in my local repository

[root@localhost persistence-hbase]# find /root/.m2/repository/org/mockito/ /root/.m2/repository/org/mockito/ /root/.m2/repository/org/mockito/mockito-core /root/.m2/repository/org/mockito/mockito-core/1.9.5 /root/.m2/repository/org/mockito/mockito-core/1.9.5/mockito-core-1.9.5.pom /root/.m2/repository/org/mockito/mockito-core/1.9.5/mockito-core-1.9.5.jar.sha1 /root/.m2/repository/org/mockito/mockito-core/1.9.5/remote.repositories /root/.m2/repository/org/mockito/mockito-core/1.9.5/mockito-core-1.9.5.jar /root/.m2/repository/org/mockito/mockito-core/1.9.5/mockito-core-1.9.5.pom.sha1 /root/.m2/repository/org/mockito/mockito-all /root/.m2/repository/org/mockito/mockito-all/1.9.5 /root/.m2/repository/org/mockito/mockito-all/1.9.5/mockito-all-1.9.5.pom.sha1 /root/.m2/repository/org/mockito/mockito-all/1.9.5/mockito-all-1.9.5.jar /root/.m2/repository/org/mockito/mockito-all/1.9.5/mockito-all-1.9.5.jar.sha1 /root/.m2/repository/org/mockito/mockito-all/1.9.5/remote.repositories /root/.m2/repository/org/mockito/mockito-all/1.9.5/mockito-all-1.9.5.pom [root@localhost persistence-hbase]#

Here is my maven build log

[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=8, ConflictMarker.markTime=2, ConflictMarker.nodeCount=384, ConflictIdSorter.graphTim e=1, ConflictIdSorter.topsortTime=1, ConflictIdSorter.conflictIdCount=129, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=408, Co nflictResolver.conflictItemCount=291, DefaultDependencyCollector.collectTime=2483, DefaultDependencyCollector.transformTime=420} [DEBUG] org.opendaylight.tsdr:tsdr-persistence-hbase:bundle:1.0-SNAPSHOT [DEBUG] org.apache.hbase:hbase:jar:0.94.15:compile ... [DEBUG] org.mockito:mockito-all:jar:1.9.5:test .. [DEBUG] (f) classpathElements = [/root/tsdrintegration/tsdr/persistence-hbase/target/classes, /root/.m2/repository/org/apache/hbase/hbase/0.94.15/hb ase-0.94.15.jar, /root/.m2/repository/com/yammer/metrics/metrics-core/2.1.2/metrics-core-2.1.2.jar,...

I dont see the mockito jar in this classpathElements

And finally it fails

[INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /root/tsdrintegration/tsdr/persistence-hbase/src/main/java/org/opendaylight/tsdr/persistence/hbase/HBaseDataStoreFactory.java:[10,25] error: p ackage org.mockito does not exist [ERROR] /root/tsdrintegration/tsdr/persistence-hbase/src/main/java/org/opendaylight/tsdr/persistence/hbase/HBaseDataStoreFactory.java:[10,0] error: st atic import only from classes and interfaces [ERROR] /root/tsdrintegration/tsdr/persistence-hbase/src/main/java/org/opendaylight/tsdr/persistence/hbase/HBaseDataStoreFactory.java:[42,33] error: c annot find symbol

Could you help ... (more)

edit retag flag offensive close merge delete