How do I stop Maven from looking in all remote repositories for pom files of dependencies that are already installed to my local repository?
In my Maven2 project, I am depending on a jar (mule-core-2.2.1.jar) that has two dependencies which are located in remote repositories but which do not have pom files defined. So my mvn command is initially able to pull down the jars, BUT the problem is that every single time I run a mvn command, it checks ev开发者_运维问答ery single repository for both of these poms. Can I tell mvn not to check for these poms since I already have the jar in my .m2 directory?
Have you thought about just creating a POM? You could install the POM-less artifacts using
mvn install:install-file \
-Dfile=sample-artifactA-2.2.1.jar \
-DgroupId=org.mule.or.wathesle \
-DartifactId=sample-artifactA \
-Dversion=2.2.1 \
-Dpackaging=jar \
-DgeneratePom=true
Once the artifact has a POM Maven shouldn't need to check anymore.
Try this:
<dependency>
<groupId>org.mule.or.wathesle</groupId>
<artifactId>mule-core</artifactId>
<version>YOUR_MULE_VERSION</version>
<exclusions>
<exclusion>
<groupId>sample.group</groupId>
<artifactId>sample-artifactAB</artifactId>
</exclusion>
</exclusions>
</dependency>
精彩评论