Maven is failing to download the tomcat-maven-plugin snapshot - java

Even after wiping out my settings.xml, I still get this error when trying to use this snapshot dependency. Given the dependency:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<path>/licensing</path>
<tomcatWebXml>${basedir}/src/main/mock/web.xml</tomcatWebXml>
</configuration>
</plugin>
And (in the POM), the plugin repository definition:
<pluginRepository>
<id>Codehaus Snapshots</id>
<url>http://snapshots.repository.codehaus.org</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled> <!-- Workaround for MNG-2974, see note below -->
</releases>
</pluginRepository>
I'm left with the following 404 error. If I actually navigate out to that repo, the jar it's looking for isn't there, just dated ones (I'm not familiar with the mechanics of how Maven ultimately resolves expected dependency names).
Ideas?
Downloading: http://snapshots.repository.codehaus.org/org/codehaus/mojo/tomcat-maven-plugin/1.0-SNAPSHOT/tomcat-maven-pl
ugin-1.0-SNAPSHOT.jar
[INFO] Unable to find resource 'org.codehaus.mojo:tomcat-maven-plugin:maven-plugin:1.0-SNAPSHOT' in repository Codehaus
Snapshots (http://snapshots.repository.codehaus.org)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to downl
oad the artifact from any repository
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.codehaus.mojo -DartifactId=tomcat-maven-plugin -Dversion=1.0-SNAPSHOT -Dpacka
ging=maven-plugin -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.codehaus.mojo -DartifactId=tomcat-maven-plugin -Dversion=1.0-SNAPSHOT -Dpackagi
ng=maven-plugin -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
org.codehaus.mojo:tomcat-maven-plugin:maven-plugin:1.0-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
Codehaus Snapshots (http://snapshots.repository.codehaus.org)
org.codehaus.mojo:tomcat-maven-plugin:maven-plugin:1.0-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
Codehaus Snapshots (http://snapshots.repository.codehaus.org)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Jan 06 10:06:49 EST 2010
[INFO] Final Memory: 14M/36M
[INFO] ------------------------------------------------------------------------

I rechecked and, with the following pom fragments:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
...
<pluginRepositories>
<pluginRepository>
<id>Codehaus Snapshots</id>
<url>http://snapshots.repository.codehaus.org/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled> <!-- Workaround for MNG-2974, see note below -->
</releases>
</pluginRepository>
</pluginRepositories>
...
<build>
<finalName>my-webapp</finalName>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
</plugin>
...
</plugins>
...
</build>
</project>
The SNAPSHOT of the plugin has been downloaded successfully:
$ mvn clean
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building my-webapp Maven Webapp
[INFO] task-segment: [clean]
[INFO] ------------------------------------------------------------------------
[INFO] snapshot org.codehaus.mojo:tomcat-maven-plugin:1.0-SNAPSHOT: checking for updates from Codehaus Snapshots
[INFO] snapshot org.codehaus.mojo:tomcat-maven-plugin:1.0-SNAPSHOT: checking for updates from maven2-repository.dev.java.net
Downloading: http://snapshots.repository.codehaus.org//org/codehaus/mojo/tomcat-maven-plugin/1.0-SNAPSHOT/tomcat-maven-plugin-1.0-20091222.232027-11.pom
5K downloaded (tomcat-maven-plugin-1.0-20091222.232027-11.pom)
Downloading: http://snapshots.repository.codehaus.org//org/codehaus/mojo/tomcat-maven-plugin/1.0-SNAPSHOT/tomcat-maven-plugin-1.0-20091222.232027-11.jar
48K downloaded (tomcat-maven-plugin-1.0-20091222.232027-11.jar)
[INFO] [clean:clean {execution: default-clean}]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Wed Jan 06 16:13:28 CET 2010
[INFO] Final Memory: 7M/78M
[INFO] ------------------------------------------------------------------------
It's very weird because I can't see any difference, but things are working as expected. In other words, I can't reproduce...
In your local repository, do you have maven-metadata*.xml files in the 1.0-SNAPSHOT directory for the tomcat-maven-plugin artifact? Do they match the ones on the remote server? Do they correctly specify the build number and timestamp?
If they are incorrect locally, running maven with -U might help.
You might also check mvn help:effective-pom and see what Maven thinks the updatePolicy is for snapshots on that repository.
Or maybe just delete your tomcat-maven-plugin artifact from your local repository and try again.
If nothing helps, try to install it manually (download the plugin from the repository and use the mvn install:install-file mojo) or checkout the sources from the VCS and build it locally. But these options are just workarounds, you have a problem somewhere (what version of maven are you using?).

I know this post is a little old, but the tomcat maven plugin has been moved to the apache maven repository. Codehaus only hosts version 1.0 of the plugin. If you want 2.0-snapshot (so you can run tomcat 7), you need to change your pom.xml a little bit. Note that 2.0 is under development.
<repositories>
...
<repository>
<id>people.apache.snapshots</id>
<url>http://repository.apache.org/content/groups/snapshots-group/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshots</name>
<url>http://repository.apache.org/content/groups/snapshots-group/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
And your plugin configuration goes like this:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
</plugin>

Not sure exactly, but looks like they might be using some form of the "buildnumber" maven plugin to include version control revision numbers.
Take a look at http://snapshots.repository.codehaus.org//org/codehaus/mojo/tomcat-maven-plugin/1.0-SNAPSHOT/maven-metadata.xml and you'll notice that in addition to the normal stuff, theres a xml tag for buildnumber and timestamp.
This may not be ideal, but you might be able to replace:
<version>1.0-SNAPSHOT</version>
with:
<version>1.0-20091222.232027-11</version>
To at least get up and running with the latest version of the plugin.

First off let me say that you do not download the TomCat-Maven-Plugin for Eclipse like other Eclipse plugins.
You simply use the maven tools in Eclipse, to insert the correct maven plugin build commands into your maven pom.xml file.....
If anyone is having trouble understanding how to get their Maven project to run as a maven Build configuration, there are a couple of things you may need to look for:
I would like to upload an image but oh well....
In your Eclipse Web App, hopefully you have a Maven POM.xml file, if not you need to set that up first.
Then, you can right click on it and then find Maven in your menu, then the sub menu item comes up, with a choice called Add Plugin.
There is a field called "Enter groupId, artifactId or sha1, etc....
Type in the word Tomcat there.
It will then load search results in the box below.
Basically what this does is load details in your pom.xml as to which plugins to download when building with Maven.
After that you need to do the Maven build.
Then, you want to go to Run Configurations and make sure you have the correct path to where your webapp lives.
Also in that page, under goals type TomCat:run
Then apply
Finally run.
If all goes well you will have a Tomcat server running the web app.
Then you can go to a browser and enter [http://localhost:8080/webappname/defaultpagename]
and walla!

Related

mvn archetype:generate using internal maven repo

I wanted to create a maven project using "mvn archetype:generate ..." to create a maven project Skeleton. I looked up online and come up with this:
in settings.xml
<profile>
<id>PlatMigr</id>
<repositories>
<repository>
<id>internal repo</id>
<name>IT Maven Central</name>
<url>https://<internal maven repo></url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
From command line:
mvn archetype:generate -DarchetypeCatalog=internal -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.mycompany.myproj -DartifactId=ProjName
However maven still tried to download artifacts from official central maven repo:
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
We have a firewall installed to stop internet access, that's why I struggle to use internal repo in the first place. Anyone can advise on how to setup and use internal repo to create maven projects?
Edit you settings.xml in m2_home, add mirror to you nexus and create & set to active profile without central repositories

screen-recorder do not find pom.xml on artifacory

I want use screen-recorder via Maven.
<dependency>
<groupId>org.monte</groupId>
<artifactId>screen-recorder</artifactId>
<version>0.7.7</version>
</dependency>
I have more one repository:
<repository>
<id>jenkins-releases</id>
<url>http://repo.jenkins-ci.org/releases/</url>
</repository>
<repository>
<id>sonatype-releases</id>
<url>https://oss.sonatype.org/content/repositories/releases</url>
</repository>
<repository>
<id>maven.oracle.com</id>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>https://maven.oracle.com</url>
<layout>default</layout>
</repository>
When I have my Maven setting.xml is it OK for me, but for other people is it KO.
21:30:45 Downloading: http://repo.jenkins-ci.org/releases/org/monte/screen-recorder/0.7.7/screen-recorder-0.7.7.pom
21:30:46
Downloading: https://oss.sonatype.org/content/repositories/releases/org/monte/screen-recorder/0.7.7/screen-recorder-0.7.7.pom
21:30:46
Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/monte/screen-recorder/0.7.7/screen-recorder-0.7.7.pom
21:30:51
Downloading: https://maven.oracle.com/org/monte/screen-recorder/0.7.7/screen-recorder-0.7.7.pom
21:30:54
[INFO] ------------------------------------------------------------------------
16:30:54 [INFO] BUILD FAILURE
16:30:54 [INFO] ------------------------------------------------------------------------
21:30:54 [ERROR] Failed to execute goal on project foo: Could not resolve dependencies for project com.comp:foo:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.github.fii:fuu:jar:1.1.0 -> org.monte:screen-recorder:jar:0.7.7: Failed to read artifact descriptor for org.monte:screen-recorder:jar:0.7.7: Could not transfer artifact org.monte:screen-recorder:pom:0.7.7 from/to maven.oracle.com (https://maven.oracle.com): Not authorized , ReasonPhrase:Authorization Required. -> [Help 1]
http://repo.jenkins-ci.org/releases/org/monte/screen-recorder/0.7.7/screen-recorder-0.7.7.pom do not return a real 404:
{
"errors" : [ {
"status" : 404,
"message" : "File not found."
} ]
}
My build crashes because it tries to go to the Oracle repository but I would like this to load the jar file which is on http://repo.jenkins-ci.org/releases/org/monte/screen-recorder/0.7.7/screen-recorder-0.7.7.jar
how can I configure this?
Your build crashes, because it's trying to download pom (metadata file) for the artifact:
Could not transfer artifact org.monte:screen-recorder:pom:0.7.7
which is not located in the repository (only the .jar file resides there).
I would recommend manually downloading the artifact from https://github.com/stephenc/monte-screen-recorder
and installing it in your local repository.
Maven:
<dependency>
<groupId>com.github.stephenc.monte</groupId>
<artifactId>monte-screen-recorder</artifactId>
<version>0.7.7.0</version>
</dependency>

Customise maven checkstyle plugin

I'm trying to create custom checkstyle. Already have SNAPSHOT on sonatype however the test project where I'm trying to test it on is not able to pull depencency. Error is
[INFO] Building TestProject 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-checkstyle-plugin:2.10:checkstyle (default-cli) # TestProject ---
Downloading: http://repository.apache.org/snapshots/com/novoda/novoda-checkstyle-checks/1.0-SNAPSHOT/maven-metadata.xml
Downloading: http://repository.apache.org/snapshots/com/novoda/novoda-checkstyle-checks/1.0-SNAPSHOT/novoda-checkstyle-checks-1.0-SNAPSHOT.pom
[WARNING] The POM for com.novoda:novoda-checkstyle-checks:jar:1.0-SNAPSHOT is missing, no dependency information available
Downloading: http://repository.apache.org/snapshots/com/novoda/novoda-checkstyle-checks/1.0-SNAPSHOT/novoda-checkstyle-checks-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.993s
[INFO] Finished at: Thu Aug 08 16:37:42 BST 2013
[INFO] Final Memory: 6M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.10:checkstyle (default-cli) on project TestProject: Execution default-cli of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.10:checkstyle failed: Plugin org.apache.maven.plugins:maven-checkstyle-plugin:2.10 or one of its dependencies could not be resolved: Could not find artifact com.novoda:novoda-checkstyle-checks:jar:1.0-SNAPSHOT in apache.snapshots (http://repository.apache.org/snapshots) -> [Help 1]
Here is project pom
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>TestProject</groupId>
<artifactId>TestProject</artifactId>
<version>0.0.1</version>
<properties>
<checkstyle.config.location>properties/checkstyle-configuration.xml</checkstyle.config.location>
</properties>
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<dependencies>
<dependency>
<groupId>com.novoda</groupId>
<artifactId>novoda-checkstyle-checks</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Any idea why dependency plugin is not downloaded?
Solution is simple. Since it is plugin that I'm trying to fetch I need to use pluginRepositories instead of repositories
<pluginRepositories>
<pluginRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
You can see that maven is looking for the snapshot in the wrong repo http://repository.apache.org/snapshots/
Your artifact is in https://oss.sonatype.org/content/repositories/snapshots
Either the pom you are using to run is not the one that defines the sonatype <repository> or it is being overwriten. Check the effective pom in the folder where you run maven and find the definition, you will probably find it is apache.org and not sonatype's
Alternatively, it is usually not recommended to use <repository> in your poms since it makes the artifacts unusable by others that don't have access to the special repo, check this article. I prefer configuring the custom repo (sonatype snapshots) in settings.xml

How to configure Eclipse m2 plugin to find my enterprise repository?

I'm having trouble figuring out how to configure SpringSource Tool Suite's m2 plugin. In order to get maven to work from the command line, I had to point to our enterprise repository in the settings.xml file.
If I try to build inside STS, I get the following:
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/com/mycompany/maven/adp/adp-base-pom/1.0.14/adp-base-pom-1.0.14.pom
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.mycompany.edelivery:edelivery-build:current
(C:\code\workspace\edelivery-build\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not transfer artifact
com.mycompany.maven.adp:adp-base-pom:pom:1.0.14 from/to central
(http://repo1.maven.org/maven2): ConnectException and 'parent.relativePath'
points at wrong local POM # line 4,
column 11: UnresolvedAddressException -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
I presume that I need to tell STS where the enterprise repository is, how do I do that? The only thing I find under File -> Properties is a field for Active Maven Profiles and that didn't help.
Here is a snippet from the settings.xml file, what do I do with this information?
<profile>
<id>internal-profile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
<name>Enterprise Plugin Repository</name>
<url>http://svn01g.gdc.nwie.net/maven2/enterprise</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>internal-release</id>
<name>MyCompany Enterprise Repository</name>
<url>http://svn01g.gdc.nwie.net/maven2/enterprise</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
Assuming you're using release 0.12.1 or earlier of the m2eclipse plugin, all you should have to do is point m2eclipse to your local maven installation. Choose Window -> Preferences -> Maven -> Installations, click Add... and browse to the root of your Maven installation. Remember you need to do this again whenever you switch to a new workspace.
The repository should be specified in the POM. Then everybody can find it.

How do I get Maven to use the correct repositories?

I have just checked out some projects and need to build them, however I installed Maven quite some time ago (6 months maybe?) and really haven't used it since - the pom.xml for the project I have doesn't have this "http://repo1.maven.org/myurlhere" anywhere in it - it has the absolute url where the Maven repo is for the project, but Maven is still trying to download from the general Maven repo:
Macintosh:trunk$ mvn clean install
[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/url/project/project/x.x/project-x.x.pom
[INFO] Unable to find resource 'url.project:project:pom:x.x' in repository central (http://repo1.maven.org/)
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
GroupId: url.project
ArtifactId: project
Version: x.x
Reason: Unable to download the artifact from any repository
url.project:project:pom:x.x
from the specified remote repositories:
central (http://repo1.maven.org/)
Can anyone help me with what I'm not doing right?
Basically, I have just checked the projects out from the command line, cd-ed into the directory and ran mvn clean install - nothing else.
Any help is greatly appreciated.
the pom.xml for the project I have doesn't have this "http://repo1.maven.org/myurlhere" anywhere in it
All projects have http://repo1.maven.org/ declared as <repository> (and <pluginRepository>) by default. This repository, which is called the central repository, is inherited like others default settings from the "Super POM" (all projects inherit from the Super POM). So a POM is actually a combination of the Super POM, any parent POMs and the current POM. This combination is called the "effective POM" and can be printed using the effective-pom goal of the Maven Help plugin (useful for debugging).
And indeed, if you run:
mvn help:effective-pom
You'll see at least the following:
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
it has the absolute url where the maven repo is for the project but maven is still trying to download from the general maven repo
Maven will try to find dependencies in all repositories declared, including in the central one which is there by default as we saw. But, according to the trace you are showing, you only have one repository defined (the central repository) or maven would print something like this:
Reason: Unable to download the artifact from any repository
url.project:project:pom:x.x
from the specified remote repositories:
central (http://repo1.maven.org/),
another-repository (http://another/repository)
So, basically, maven is unable to find the url.project:project:pom:x.x because it is not available in central.
But without knowing which project you've checked out (it has maybe specific instructions) or which dependency is missing (it can maybe be found in another repository), it's impossible to help you further.
By default, Maven will always look in the official Maven repository, which is http://repo1.maven.org.
When Maven tries to build a project, it will look in your local repository (by default ~/.m2/repository but you can configure it by changing the <localRepository> value in your ~/.m2/settings.xml) to find any dependency, plugin or report defined in your pom.xml. If the adequate artifact is not found in your local repository, it will look in all external repositories configured, starting with the default one, http://repo1.maven.org.
You can configure Maven to avoid this default repository by setting a mirror in your settings.xml file:
<mirrors>
<mirror>
<id>repoMirror</id>
<name>Our mirror for Maven repository</name>
<url>http://the/server/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
This way, instead of contacting http://repo1.maven.org, Maven will contact your entreprise repository (http://the/server in this example).
If you want to add another repository, you can define a new one in your settings.xml file:
<profiles>
<profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>foo.bar</id>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<url>http://new/repository/server</url>
</repository>
</repositories>
You can see the complete settings.xml model here.
Concerning the clean process, you can ask Maven to run it offline. In this case, Maven will not try to reach any external repositories:
mvn -o clean
tl;dr
All maven POMs inherit from a base Super POM.
The snippet below is part of the Super POM for Maven 3.5.4.
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
I think what you have missed here is this:
https://maven.apache.org/settings.html#Servers
The repositories for download and deployment are defined by the repositories and distributionManagement elements of the POM. However, certain settings such as username and password should not be distributed along with the pom.xml. This type of information should exist on the build server in the settings.xml.
This is the prefered way of using custom repos. So probably what is happening is that the url of this repo is in settings.xml of the build server.
Once you get hold of the url and credentials, you can put them in your machine here: ~/.m2/settings.xml like this:
<settings ...>
.
.
.
<servers>
<server>
<id>internal-repository-group</id>
<username>YOUR-USERNAME-HERE</username>
<password>YOUR-PASSWORD-HERE</password>
</server>
</servers>
</settings>
EDIT:
You then need to refer this repository into project POM. The id internal-repository-group can be used in every project. You can setup multiple repos and credentials setting using different IDs in settings xml.
The advantage of this approach is that project can be shared without worrying about the credentials and don't have to mention the credentials in every project.
Following is a sample pom of a project using "internal-repository-group"
<repositories>
<repository>
<id>internal-repository-group</id>
<name>repo-name</name>
<url>http://project.com/yourrepourl/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
Basically, all Maven is telling you is that certain dependencies in your project are not available in the central maven repository. The default is to look in your local .m2 folder (local repository), and then any configured repositories in your POM, and then the central maven repository. Look at the repositories section of the Maven reference.
The problem is that the project that was checked in didn't configure the POM in such a way that all the dependencies could be found and the project could be built from scratch.

Categories