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>
Related
I am trying to import Ripple Effect library by using maven https://github.com/traex/RippleEffect.
It says "The lib is available on Maven Central, you can find it with Gradle, please". I have no idea what Gradle, please is and it's information (http://gradleplease.appspot.com/#rippleeffect) didn't help me at all.
I found how to import it by using maven. I added this dependency to my POM:
<dependency>
<groupId>com.github.traex.rippleeffect</groupId>
<artifactId>library</artifactId>
<version>1.3</version>
</dependency>
and made sure that I have Maven central repository:
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
However, when I try to run the project, it says:
Failed to execute goal on project ProjectName: Could not resolve dependencies for project lt.adnera:ProjectName:apk:0.0.1-SNAPSHOT: Failure to find com.github.traex.rippleeffect:library:jar:1.3 in http://repo1.maven.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
Any ideas?
According to http://repo1.maven.org/maven2/com/github/traex/rippleeffect/library/1.3/library-1.3.pom the packaging is aar so there is no jar which can be downloaded.
Try:
<dependency>
<groupId>com.github.traex.rippleeffect</groupId>
<artifactId>library</artifactId>
<version>1.3</version>
<type>aar</type>
</dependency>
additional Infos: http://simpligility.github.io/android-maven-plugin/aar.html
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.
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.
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>