Spring-data-elasticsearch maven dependency not found - java

I clone repository from https://github.com/spring-projects/spring-data-elasticsearch/blob/master/pom.xml
In pom.xml I have:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.M2</version>
</dependency>
but maven can not find this lib in repository.
I also try: https://github.com/spring-projects/spring-data-elasticsearch
but it is the same spring-data-elasticsearch version.

I'm assuming you're using Maven Central as your repository. I didn't see it there either.
According to the project site, spring-data-elasticsearch is available at http://repo.spring.io/libs-milestone. Did you try this repo?

Try to use the following repository.
<repositories>
<repository>
<id>spring-snapshot</id>
<name>Spring Maven SNAPSHOT Repository</name>
<url>http://repo.springsource.org/libs-snapshot</url>
</repository>
</repositories>
Dependency
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.M1</version>
</dependency>

I try once again after few hours and It works. Seriously I have no idea why. Correct configuration is:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.RC1</version>
</dependency>
<repository>
<id>spring-libs-milestone</id>
<name>Spring Milestone Repository</name>
<url>http://repo.spring.io/libs-milestone</url>
</repository>

I am not understanding where is the confusion here ?
Project is not yet fully released hence it's still using milestone repo of springsource instead of maven central repo. It will get released within 2 weeks with Spring Data release train Dijkstra.
Spring Data Elasticsearch GitHub page stats that
Maven configuration
Add the Maven dependency:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.RC1</version>
</dependency>
<repository>
<id>spring-libs-milestone</id>
<name>Spring Milestone Repository</name>
<url>http://repo.spring.io/libs-milestone</url>
</repository>
If you'd rather like the latest snapshots of the upcoming major version, use our Maven snapshot repository and declare the appropriate dependency version.
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
</dependency>
<repository>
<id>spring-libs-snapshot</id>
<name>Spring Snapshot Repository</name>
<url>http://repo.spring.io/libs-snapshot</url>
</repository>

Related

Cannot resolve com.palantir.docker.compose:docker-compose-rule-junit4:0.32.0

Trying to drag this dependency from maven but get error, what could be the issue?
Cannot resolve com.palantir.docker.compose:docker-compose-rule-junit4:0.32.0
<dependency>
<groupId>com.palantir.docker.compose</groupId>
<artifactId>docker-compose-rule-junit4</artifactId>
<version>0.32.0</version>
</dependency>
The packet did not exist in maven central repo https://repo.maven.apache.org/maven2, so I had to add extra one.
<repositories>
<repository>
<id>Palantir</id>
<url>https://dl.bintray.com/palantir/releases/</url>
</repository>
</repositories>

Missing artifact org.springframework:spring-beans:jar:5.0.0.M4

I have a java spring mvc apication. and when i add the following dependency into the pom.xml:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.0.0.M4</version>
</dependency>
it complains with:
Missing artifact org.springframework:spring-beans:jar:5.0.0.M4
So, what is wrong in my pom?
It is a milestones (pre released) version, which is not available in Maven. If you want to use it you can add spring milestones repository to your pom.xml.
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
However, since it's a pre-released version, it is not advisable to use it in production environment, unless you have a specific requirement/ feature that is only available in new version, since it may contain bugs.
use bellow version of dependency from current version of Spring-Beans. you can use bellow dependency :-
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.8.RELEASE</version>
</dependency>
after adding this update maven project
By default pom.xml has repository mentioned as below.
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
As 5.0.0.M4 is milestone version like alpha or beta version, mentioned dependency/jar is not present in maven central repository so error is produced.Add below lines in pom.xml and dependency will get downloaded.
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>myrepo</id>
<url>https://artifacts.alfresco.com/nexus/content/repositories/public/</url>
</repository>
</repositories>

Sikulix maven project

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.

Maven looking for dependency in wrong repo

I have a snapshot maven repo defined:
<repositories>
<repository>
<id>tmp-repo</id>
<url>https://my-snapshot-repo</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
The problem is, for some reason, maven is looking for the following two dependencies:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcomponents-core</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcomponents-client</artifactId>
<version>4.4</version>
</dependency>
In the snapshot repo rather than the stable maven repo. Each compile gives this error:
[ERROR] Failed to execute goal on project myProject: Could not resolve
dependencies for project com.myGroupId:myArtifact:jar:1.0-SNAPSHOT:
The following artifacts could not be resolved:
org.apache.httpcomponents:httpcomponents-core:jar:4.4,
org.apache.httpcomponents:httpcomponents-client:jar:4.4: Could not
find artifact org.apache.httpcomponents:httpcomponents-core:jar:4.4 in
tmp-repo (https://my-snapshot-repo)
How do I force maven to not look for this dependency in the snapshot repo?
Before your edit, your original configuration said:
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
You said that this repo holds releases, as well as snapshots, so Maven is looking there.
Now you've removed <releases>, it shouldn't be doing that. Make sure you don't have any other repository definitions taking effect.

Spring security 4.0.0 in maven?

There is the documentation about spring security 4.0.0 but in maven repository the latest version is 3.2.5. Where can I get the jar?
As it's said in the doc, you have to add a new repository in your pom.xml
http://docs.spring.io/spring-security/site/docs/4.0.0.RC1/reference/htmlsingle/#maven-repositories
And then you'll find the dependency in 4.0.0 version
Spring security 4.0.0.RELEASE has not been released yet.
Use the following snippet for 4.0.0.RC1:
<dependencies>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.0.0.RC1</version>
</dependency>
</dependencies><repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
See here: http://projects.spring.io/spring-security/
The release version of Spring are hosted on Maven Central. However, if you want to use milestone or snapshot versions , then a custom Spring repository needs to be added to the pom
In your case 4.0 is in snapshot version
So First Add A New Custom Repository
<repositories>
<repository>
<id>repository.springframework.maven.snapshot</id>
<name>Spring Framework Maven Snapshot Repository</name>
<url>http://repo.spring.io/snapshot/</url>
</repository>
</repositories>
Once You Define A Custom Repo Define Dependencies For Snapshot Build
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.0.3.BUILD-SNAPSHOT</version>
</dependency>

Categories

Resources