I am trying to add fmt-maven-plugin (https://mvnrepository.com/artifact/com.coveo/fmt-maven-plugin/2.13) as dependency so I added below code in my POM xml file
<dependency>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.13</version>
</dependency>
Also I have below repo details in my settings.xml
<profile>
<id>maven-https</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
But I get below error while running build,
[ERROR] Plugin com.spotify.fmt:fmt-maven-plugin:2.13 or one of its dependencies could not be resolved: Could not find artifact com.spotify.fmt:fmt-maven-plugin:jar:2.13 in central (https://repo1.maven.org/maven2) -> [Help 1]
My understanding is maven could not download fmt-maven-plugin:2.13 from given https://repo1.maven.org/maven2 repo but I am not sure what repo to add in order to download fmt-maven-plugin. Can anyone suggest me?
Related
I need to add fast-md5 to dependencies which lays at https://repo.spring.io/plugins-release/, so I configure settings.xml like
<profiles>
<profile>
<id>main</id>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>centralx</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
<repository>
<id>spring</id>
<url>https://repo.spring.io/plugins-release/</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>main</activeProfile>
</activeProfiles>
But now all dependencies are missing. The error message is
Missing artifact commons-io:commons-io:jar:2.5
So How to configure multiple repositories?
I want to use maven's dependency:get to download a package. I need to configure both a remote repository and a plugin repository. If I configure it in settings.xml it works:
(Example settings.xml from https://maven.apache.org/settings.html)
<profiles>
<profile>
...
<repositories>
<repository>
<id>codehausSnapshots</id>
<name>Codehaus Snapshots</name>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>http://snapshots.maven.codehaus.org/maven2</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
...
</pluginRepositories>
...
</profile>
</profiles>
...
</settings>
mvn dependency:get -Dartifact=<artifact>
However I would like to be able to do this without configuring the settings.xml file. I know dependency:get lets you specify a -DremoteRepositories argument. There there any way to specify the plugin repository? In my particular case both repositories are actually the same location however if I only provide -DremoteRepositories maven fails to download the plugins.
In Gradle, I need simply add:
repositories {
jcenter()
}
What is the simplest and proper way to do the same in maven pom.xml or where can I get right url for jcenter repository.
You have to define settings.xml like the following. If you define it in ~/.m2/settings.xml it will be global to your maven. If you define it as a resource of your project you can bind it with the -s parameter:
mvn -s settings.xml compile
<?xml version="1.0" encoding="UTF-8" ?>
<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray-plugins</name>
<url>https://jcenter.bintray.com</url>
</pluginRepository>
</pluginRepositories>
<id>bintray</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>bintray</activeProfile>
</activeProfiles>
</settings>
Just add a repositories section in your pom:
<repositories>
<repository>
<id>jcenter</id>
<name>jcenter</name>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>
The official documentation from JFrog JCenter is in:
https://bintray.com/bintray/jcenter
Hit the SET ME UP! button on the upper right corner.
I would like to secure the connection to repo.maven.apache.org when resolving dependencies (I wolud like to secure all connections made by Maven actually), but I'm not used to Maven configuration... My user settings.xml contains the following repositories and pluginRepositories sections:
<profiles>
<profile>
<id>main</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo.maven.apache.org</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://repo.maven.apache.org</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
However Maven is unable to resolve dependencies with that setup.
Open the file $MAVEN_HOME/conf/settings.xml (where $MAVEN_HOME is the folder in which Maven has been installed) in a text editor. Then, add the following to the <mirrors>...</mirrors> section in this file:
<mirror>
<id>central-secure</id>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
I am using maven 3.0 and Apache Archiva as remote internal repository (configured as mirrior in settings.xml) but I am having problems downloading SNAPSHOT artifacts.
Failed to execute goal on project IntegrationTests: Could not resolve dependencies for project com.br.bigdata:IntegrationTests:jar:1.0-SNAPSHOT: Could not find artifact com.br.bigdata:HBaseSchema:jar:1.0-SNAPSHOT in archiva.default (.../archiva/repository/internal/) -> [Help 1]
I checked similar posts here but couldn't resolve my problem.
I checked the Archiva repository, artifact is present, correct pom versions etc.
In my pom the dependency is specified:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>HBaseSchema</artifactId>
<version>${version.hbaseSchema}</version>
<scope>test</scope>
</dependency>
The artifact pom:
<groupId>com.br.bigdata</groupId>
<artifactId>HBaseSchema</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>HBaseSchema</name>
<description>Logical HBase schema</description>
Sorted. This needs to be added to settings.xml
<mirror>
<id>archiva.snapshots</id>
<url>http://localhost:8080/archiva/repository/snapshots</url>
<mirrorOf>snapshots</mirrorOf>
</mirror>
and
<profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>internal</id>
<name>Archiva Managed Internal Repository</name>
<url>https://lab-insighttc:8080/archiva/repository/internal</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<name>Archiva Managed Internal Repository</name>
<url>https://lab-insighttc:8080/archiva/repository/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>