I am trying to add the "selenium standalone server jar" to my maven project. I found this:
https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server-standalone/2.53.0
Copying the dependency is giving me a missing artifact error which probably mean my current maven settings isn't pointing to the repo that has this jar file. The url is http://repo.jenkins-ci.org/releases/org/seleniumhq/selenium/selenium-server-standalone/2.53.0/ How to I update my pom file so that I can add this dependency?
Check maven documentation:
https://maven.apache.org/guides/mini/guide-multiple-repositories.html
<project>
...
<repositories>
<repository>
<id>my-repo1</id>
<name>your custom repo</name>
<url>http://jarsm2.dyndns.dk</url>
</repository>
<repository>
<id>my-repo2</id>
<name>your custom repo</name>
<url>http://jarsm2.dyndns.dk</url>
</repository>
</repositories>
...
</project>
Related
I have a local Java intelli-J project with a pom.xml that has (2) internal repositories on artifactory. The problem is I am doing some testing, and I think one of the JARs is not on this internal repo, so I want to use the regular Maven central repo. I googled and believe, the artifact should go through the list in your pom.xml is the order its listed and try to resolve the artifact, the problem is, even when I add the Maven central repo, it seems to never attempt; only tries the internal artifactory then fails.
In my pom.xml:
<repositories>
<repository>
<id>test</id>
<name>Maven Central</name>
<layout>default</layout>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>my_repo</id>
<name>MyRepo</name>
<url>https://myinternalrepo.com</url>
</repository>
<repository>
<snapshots />
<id>MySnapShotRepo</id>
<name>MyInternalRepo</name>
<url>https://myinternalreposnapshots.com</url>
</repository>
</repositories>
am I doing something wrong here?
I removed my settings.xml and was able to control the repositories from the pom.xml file tag. It also looks like maven repo is automatically tried whether you list it or not in pom .
I have an old project which uses spring data and neo4j. I'm trying to build it, but maven is not able to find the neo4j-cypher-dsl dependency. The dependency is defined as follows:
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher-dsl</artifactId>
<version>2.0.1</version>
</dependency>
These are the repositories that I have configured in pom.xml:
<repositories>
<repository>
<id>neo4j</id>
<url>http://m2.neo4j.org/</url>
</repository>
<repository>
<id>neo4j-releases</id>
<url>http://m2.neo4j.org/content/repositories/releases/</url>
</repository>
</repositories>
And this is the error that I'm getting from maven:
[ERROR] Failed to execute goal on project evidencefactory: Could not
resolve dependencies for project
com.evidencefactory:evidencefactory:war:0.9-SNAPSHOT: Failed to
collect dependencies at
org.springframework.data:spring-data-neo4j-rest:jar:3.1.0.RELEASE ->
org.springframework.data:spring-data-neo4j:jar:3.1.0.RELEASE ->
org.neo4j:neo4j-cypher-dsl:jar:2.0.1: Failed to read artifact
descriptor for org.neo4j:neo4j-cypher-dsl:jar:2.0.1: Could not
transfer artifact org.neo4j:neo4j-cypher-dsl:pom:2.0.1 from/to neo4j
(http://m2.neo4j.org/): Failed to transfer file
http://m2.neo4j.org/org/neo4j/neo4j-cypher-dsl/2.0.1/neo4j-cypher-dsl-2.0.1.pom
with status code 502 -> [Help 1]
Does anyone know where I can find this old neo4j dependency?
Updating my answer to use another repo.
See my comment below for the location of the artifacts.
Adding this to my pom.xml builds this dependency.
<repositories>
<repository>
<id>xebialabs-releases</id>
<url>https://plugins.xebialabs.com/nexus/content/groups/public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
Is it possible to add remote repository jar file (https://repo.ah/lib/abc.jar) in maven pom.xml as dependency in java project. if so, can you please share example.
No, it's not possible to add a complete repository as a dependency. This doesn't make sense, because a repository can contain ten thousands of artifacts.
If your project requires artifacts which are not hosted in the standard remote repository, you can specify this via the <repositories> tag in your pom.xml .
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
More Informations:
Introduction to Repositories
Setting up Multiple Repositories
In the comments you mentioned that the URL is an Artifactory.
So just add the Artifactory as <repository> to your settings.xml and then you can use the jar in your application.
I want to use Sikulix in my maven project but it doesn't work, I tried to add the repository like it says (http://sikulix-2014.readthedocs.org/en/latest/faq/030-java-dev.html#a-comment-on-projects-using-maven) and when I do "mvn install" it says "Could not find artifact com.sikulix:sikulixapi:jar:1.1.0-SNAPSHOT in nexus" where nexus is our repository.
My pom contains that:
...
<repositories>
<repository>
<id>com.sikulix</id>
<name>com.sikulix</name>
<url>https://oss.sonatype.org/content/groups/public</url>
<layout>default</layout>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
</dependencies>
...
Any idea why maven does not find the artifact in the correct repo?
The problem is solved. In the settings.xml we had a so maven always used the same repo.
I just removed the mirror because we didn't use it anymore, but I think that adding the additional repository there it would work too.
The problem is that I'm trying to make somelike the helloworld with Activiti but I have an error here
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>5.1</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring</artifactId>
<version>5.1</version>
</dependency>
the error is the following: 'Description Resource Path Location Type
Missing artifact org.activiti:activiti-engine:jar:5.1 pom.xml /IllMakeThisTestApp line 29 Maven Dependency Problem
Trying to resolve it I've found the following recomendation here: "The download contains all the libraries that you need to work with Activiti. But for developers that prefer to use Maven, add the following reposiory"
<repositories>
<repository>
<id>Alfresco Maven Repository</id>
<url>https://maven.alfresco.com/nexus/content/groups/public/</url>
</repository>
</repositories>
But where shall I place it? To the file called settings.ini placed in M2_HOME/conf? This file is full of comments with no any sign of repositories. So I have no idea how to do this and ask you for help
You should place that in your pom.xml - see the Maven reference on the subject:
<project xmlns="http://maven.apache.org/POM/4.0.0"...
...
<repositories>
<repository>
<id>Alfresco Maven Repository</id>
...
You will only need to tinker with the Maven config if you need to setup a mirror for the repo, eg. in case your organisation has it's own Nexus/other repo mirroring the outside "world".
Cheers,
You can place right under project. For example
<project>
....
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</project>
In default maven will try to download all the artifacts from maven central. You can add any number of added repositories using tag given above. Alfresco is yet another open maven repository.