burning_wipf
burning_wipf

Reputation: 96

How does Maven satisfy GroupID:Artifact dependencies defiend in the pom.xml?

I have been passed a maven project without much documentation and while trying to compile it with "mvn compile" i am running into this error:

Could not resolve dependencies for project de.companyName:tcui-web:war:2.1.0: Could not find artifact de.companyName:spring-commons-config:jar:0.0.1-SNAPSHOT ... 

The META-INF/MANIFEST.MF file doesn't seem to give me any clues as to where the dependency could be satisfied from.

    Manifest-Version: 1.0
Implementation-Title: TCUI
Implementation-Version: test-version
Built-By: REDACTED
Created-By: Apache Maven 3.2.3
Implementation-URL: tc.company.de
url: tc.company.de
version: test-version
mode: development
Implementation-Vendor: Company
revision: test-revision
Implementation-Vendor-Id: de.company
Build-Jdk: 1.7.0_67
Archiver-Version: Plexus Archiver
bambooBuild: 000

What possible ways does MVN give me to locate those dependencies and satisfy them manually?

Apart from the manifest file, where could i find specific urls / paths to the dependencies?

Am I maybe approaching this issue from a completely incorrect direction due to my lack of knowledge about java?

Upvotes: 1

Views: 120

Answers (1)

Martin Devillers
Martin Devillers

Reputation: 18002

Maven resolves dependencies by looking them up in one or more repositories. A Maven repository is an archive containing artifacts (usually jar files with some metadata). By default, Maven will use the Maven Central repository, which is a public repository that contains most popular open source libraries. Judging by the name of your specific dependency de.companyName:tcui-web:war:2.1.0 is probably an internal closed-source dependency, rather than a public one. This means it is not stored in Maven Central, which is why you're receiving that error. Maven is looking for your artifact but probably in the wrong place. So how do you solve this? There are two options:

  1. Your client's organization has its own internal Maven repository that contains internally developed or acquired artifacts. If so you need to ask for the url (and possibly credentials) of this repository and configure your local Maven installation so it will use your company's internal Maven repository to resolve dependencies. This is usually the preferred way to handling internal artifacts within an organization.
  2. If you have access to the jar file, you can install it manually in your local Maven repository. Every machine with Maven installed has its own local repository. That's how Maven works. It first queries the local repository, then if the artifact is not there it will query a remote repository (which can be Maven Central or one provided by your organization) and pull in a copy so it's available locally. But you can bypass this by installing artifacts directly into your local repository. This is usually not recommended since you have to repeat this step on every development machine and build server. Of course you could script this but at that point it'd probably be easier to setup a custom Maven repository since it's quite simple to do so.

Upvotes: 2

Related Questions