My pom.xml use the following code to define the company ‘s internal Maven repository such that the dependencies will be downloaded from this repository if they cannot be found in my local repository.
<repositories>
<repository>
<id>XXXXXX</id>
<name>Internal Repository</name>
<url>http://private.ip/nexus-webapp/content/groups/public/</url>
</repository>
</repositories>
When I add some dependencies in pom.xml , I find that the dependencies I added will also be added to that internal repository . Besides deleting <repositories> section in pom.xml , can I configure its attributes such that the dependencies added in the pom.xml will not be added to this internal repository?
It sounds like what you’re talking about is Nexus’ proxying mechanism. You request artifacts from Nexus, and it looks at configured outside repos for the artifacts, caches them locally and returns them to you. That assumes the repositories in question are configured to be proxied through Nexus, of course. If someone set it up that way, then why do you want to circumvent it? You’d use Nexus in this way so the artifacts are closer to you and your builds work faster. The only way you’d get this not to happen is to change the settings in Nexus or else stop using it. You don’t have to remove the repo entirely from the pom. Just put other repos ahead of it, and Maven will look in those first. But again, why would you not want to use Nexus as it was designed as a near cache for artifacts?