I'm trying to configure Spring 3.0 with Maven. I've read http://blog.springsource.com/2009/12/02/obtaining-spring-3-artifacts-with-maven/
In my pom.xml I've defined the following repositories:
<repositories>
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>EBR Spring Release Repository</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>EBR External Release Repository</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
</repositories>
Then I tried with the most basic dependency:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
where
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<org.springframework.version>3.0.5-RELEASE</org.springframework.version>
</properties>
However, if he spring-core is not found.
[WARNING] The POM for org.springframework:org.springframework.core:jar:3.0.5-RELEASE is missing, no dependency information available
[ERROR] Failed to execute goal on project spring-recipes: Could not resolve dependencies for project org.obliquid:spring-recipes:war:0.0.1-SNAPSHOT: Could not find artifact org.springframework:org.springframework.core:jar:3.0.5-RELEASE in com.springsource.repository.bundles.release (http://repository.springsource.com/maven/bundles/release) -> [Help 1]
What can I do to solve the problem?
It should be
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
instead of
<org.springframework.version>3.0.5-RELEASE</org.springframework.version>
Related
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>
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.
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.
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>
I'm trying to build my java hibernate project with maven.
But when I try to do this, it looks like there is a dependency not available?
I have this pom.xml now in my project:
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>net.viralpatel.hibernate</groupId>
<artifactId>HibernateHelloWorldXML</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>HibernateHelloWorldXML</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>ejb3-persistence</artifactId>
<version>1.0.1.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.1.GA</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.10</version>
</dependency>
</dependencies>
</project>
When I try to build using mvn then I get this error:
[WARNING] An error occurred during dependency resolution.
Failed to retrieve javax.transaction:jta-1.0.1B
Caused by: Failure to find javax.transaction:jta:jar:1.0.1B in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will
not be reattempted until the update interval of central has elapsed or updates are forced
Try downloading the file manually from:
http://java.sun.com/products/jta
Then, install it using the command:
mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -Drepository
Id=[id]
Path to dependency:
1) net.viralpatel.hibernate:HibernateHelloWorldXML:jar:1.0-SNAPSHOT
2) org.hibernate:hibernate-annotations:jar:3.3.1.GA
3) org.hibernate:hibernate:jar:3.2.6.ga
4) javax.transaction:jta:jar:1.0.1B
javax.transaction:jta:jar:1.0.1B
from the specified remote repositories:
central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false)
I searched for this error and found a lot of people that had to change their hibernate-core dependency version in their pom.xml file but it seems like I don't have a hibernate-core, so how can I solve this?
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.3.2.ga</version>
</dependency>
it has a recommended dependency for JTA 1.1.
OR
You can add "http://download.java.net/maven/2" as new repository in pom.xml or settings.xml
<repository>
<id>java.net.m2repo</id>
<name>java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
For any JEE library provided by Sun or oracle .. Add below repository
<repositories>
<repository>
<id>GlassFish</id>
<name>GlassFish Maven Repository</name>
<url>http://download.java.net/maven/glassfish/</url>
</repository>
<repository>
<id>java.net.m1repo</id>
<name>java.net Maven 1 Repository</name>
<url>http://download.java.net/maven/1/</url>
<layout>legacy</layout>
</repository>
<repository>
<id>java.net.m2repo</id>
<name>java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
I have the same problem and I have downloaded the jta-1.0.1B.jar file manually from http://www.java2s.com/Code/Jar/j/Downloadjta101Bjar.htm
Im using Netbeans7.3. I expanded dependencies folder in the project and found the jta-1.0.1B.jar with small yellow icon(meant for error). Then I right click and use the option "Manually install artifact" and point to the location of the file jta-1.0.1B.jar. Solved.
Step:1 I have the same problem and I have downloaded the jta-1.0.1B.jar file manually from http://www.java2s.com/Code/Jar/j/Downloadjta101Bjar.htm and kept it in F drive.
Step:2 Ran the below command
mvn install:install-file -Dfile=F:\jta-1.0.1B.jar -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar
You can download this jar from http://www.java2s.com/Code/Jar/j/Downloadjta101bjar.htm and install it in your local maven with following command:
mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=jta-1.0.1b.jar
Please add below repo in pom.xml -
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/
</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>