google salve - maven - maven-2

I tried to install google salve http://code.google.com/p/salve/ by adding following statements in the project's pom file:
However, when running mvn dependency:resolve it states "unable to find resource "salve:salve:jar:2.0" in repository salve
What's wrong?
<dependency>
<groupId>salve</groupId>
<artifactId>salve</artifactId>
<version>2.0</version>
</dependency>
<repository>
<id>salve</id>
<name>Google Maven Repository</name>
<url>http://salve.googlecode.com/svn/maven2/</url>
</repository>

The salve artifact you're mentioning is a pom (and indeed, there is no salve:salve:jar:2.0). If this is really the dependency you want to declare, you need to specify the type:
<project>
...
<repositories>
<repository>
<id>salve</id>
<name>Google Maven Repository</name>
<url>http://salve.googlecode.com/svn/maven2/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>salve</groupId>
<artifactId>salve</artifactId>
<version>2.0</version>
<type>pom</type>
</dependency>
...
</dependencies>
</project>
Honestly, I doubt you want the pom but I can't tell you which artifact you need.
Update: I guess you would have figured this out yourself but for salve-depend-guice, use the following dependency:
<dependency>
<groupId>salve</groupId>
<artifactId>salve-depend-guice</artifactId>
<version>2.0</version>
</dependency>
The dependencies of the above artifact will be downloaded transitively by Maven.

Related

Oracle jdbc jar unable to down load in maven plugin

[WARNING] The POM for com.oracle:ojdbc7:jar:12.1.0 is missing, no dependency information available
<!-- Oracle JDBC driver -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0</version>
</dependency>
<!-- HikariCP connection pool -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.6.0</version>
</dependency>
The latest release of the oracle jdbc driver is available in maven central since a few days (september 2019, announced at Oracle CodeOne), there is no longer a need to install it locally or add obscure other repositories.
See https://medium.com/oracledevs/oracle-jdbc-drivers-on-maven-central-64fcf724d8b
The coordinates are
<!-- https://mvnrepository.com/artifact/com.oracle.ojdbc/ojdbc8 -->
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
</dependency>
ojdbc7 is absent in the maven central repository
You need to download jar from oracle.com.
Currently it can be downloaded here. Registration is needed.
https://www.oracle.com/database/technologies/jdbc-upc-downloads.html
Then import ojdbc7.jar into your local maven repository with the following command
mvn install:install-file -Dfile=ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.2 -Dpackaging=jar -DgeneratePom=true
Alternatively, if your team has it's own remote maven repository, import it there.
edit: fixed mvn command and link
Add repository to your build and download:
See on mvnrepository.com
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>HandChina-RDC</id>
<name>HandChina RDC</name>
<url>http://nexus.saas.hand-china.com/content/repositories/rdc/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
</dependencies>
</project>

Error getting POM for 'org.codehaus.mojo:jasperreports-maven-plugin' from the repository

I am trying to deploy OSGI bundle to Jboss 7.1.1.Final. Everytime I compile and deploy project it gives me following error.
I have checked in M2, only 1.0-beta-2 version is present as we can see similar thing mentioned in repository too http://mvnrepository.com/artifact/org.codehaus.mojo/jasperreports-maven-plugin/1.0-beta-2
There is no version defined in POM, not sure from where it is trying to pull this version.
Command
mvn jboss-as:deploy -Pdomain -DskipTests -Dusername=manish -Dpassword=password -Dhost=x.x.x.x -Dport=9999 -X
POM Configuration
<repository>
<id>jboss-public-repository</id>
<name>JBoss Repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>jasperreports</id>
<url>http://jasperreports.sourceforge.net/maven2</url>
</repository>
</repositories>
...
<plugins>
<!-- Jasper Plugins -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<configuration>
<outputDirectory>${project.build.directory}/jasper</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile-reports</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>4.7.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.7.5</version>
</dependency>
</dependencies>
</plugin>
Error
Caused by: org.apache.maven.project.ProjectBuildingException: Error getting POM for 'org.codehaus.mojo:jasperreports-maven-plugin' from the repository: Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.
org.codehaus.mojo:jasperreports-maven-plugin:pom:1.0-beta-3-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
jboss-public-repository (https://repository.jboss.org/nexus/content/groups/public)
for project org.codehaus.mojo:jasperreports-maven-plugin
at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:592)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:251)
at org.apache.maven.project.artifact.MavenMetadataSource.retrieveRelocatedProject(MavenMetadataSource.java:163)
... 22 more
The jasperreport plugin is available via Maven central but not as a SNAPSHOT version. The question is if you need to use the SNAPSHOT version or the release version which can be found here.

Error in maven while downloading dependencies

My project1 and project2 were working fine with maven builds. Recently I upgraded from maven2 to maven3 using this tutorial (I checked it on maven2,but it didn't work either). Everything worked and is working fine for project2 which has a private (self hosted) Nexus repo.
But, now I am getting error while downloading dependencies for my project1 (using public maven repo).
My pom.xml:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.dds.server.DDSStartup</groupId>
<artifactId>storage</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>storage</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>r07</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>com.sleepycat</groupId>
<artifactId>je</artifactId>
<version>3.3.75</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>jgroups</groupId>
<artifactId>jgroups-all</artifactId>
<version>2.4.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>oracleReleases</id>
<name>Oracle Released Java Packages</name>
<url>http://download.oracle.com/maven</url>
<layout>default</layout>
</repository>
</repositories>
</project>
Where am I going wrong, this is the error I get when I do a : mvn clean package
[ERROR] Failed to execute goal on project storage: Could not resolve dependencies for project com.dds.server.DDSStartup:DynamicDistributedStorage:jar:1.0-SNAPSHOT: Failed to collect dependencies for [junit:junit:jar:3.8.1 (test), com.google.guava:guava:jar:r07 (compile), log4j:log4j:jar:1.2.16 (compile), com.sleepycat:je:jar:3.3.75 (compile), com.google.protobuf:protobuf-java:jar:2.3.0 (compile), jgroups:jgroups-all:jar:2.4.1 (compile)]: Failed to read artifact descriptor for log4j:log4j:jar:1.2.6: Could not transfer artifact log4j:log4j:pom:1.2.6 from/to oracleReleases (http://download.oracle.com/maven): /Users/username/.m2/repository/log4j/log4j/1.2.6/log4j-1.2.6.pom.ahc65d8d087349b4a46 (No such file or directory) -> [Help 1]
UPDATE:
I deleted everything (workspace), imported the project again and it worked like a charm. Nothing can beat that solution! ;)
This shouldn't be working with maven2 either.
From the error message, it looks like maven is trying to download dependencies from the repository specified in your pom - oracleReleases (http://download.oracle.com/maven) and not the public maven repo. This appears to be an invalid repository url.
Perhaps you should try removing the section and retry.
This is covered by another stackoverflow question which boils down to the Oracle repo not allowing directory listings.
I had the dependencies versions externalized as properties. Like:
<properties>
[...]
<hibernate-core.version>4.1.3.Final</hibernate-core.version>
[...]
</properties>
And:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate-core.version}</version>
</dependency>
I closed the project, changed the version declaration to be explicit as
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.3.Final</version>
</dependency>
it worked!
The URL in orcacleReleases seems wrong, it does point to a 404, maybe oracle did move it ?

Where did the EclipseLink/Maven repository go to?

The link quoted on the EclipseLink/Maven wiki ends on an Error 403 page on switch.ch. If you are redirected to a better mirror then that would already be the answer.
If not: where did the repository go to? Searching the net only reveals that EclipseLink/Maven hat a history of typos on there Wiki-Page. However all the corrected links I found end on error pages as well.
The only link I see is:
http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo
and it seems to works just fine, redirecting it to
http://www.gtlib.gatech.edu/pub/eclipse/rt/eclipselink/maven.repo/
The URL from that page
http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo
works for me and redirects to
http://eclipse.ialto.org/rt/eclipselink/maven.repo/
However, inside a pom.xml, I had to escape the &:
<repositories>
<repository>
<id>eclipselink</id>
<url>http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo/</url>
</repository>
</repositories>
Just faced the same problem today.
It appears that the URL provided on their Maven wiki page http://wiki.eclipse.org/EclipseLink/Maven works. But it works in a weird way: their repository is not indexed so if you try just to add this into pom.xml:
<repositories>
<repository>
<id>EclipseLink Repo</id>
<url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
and then try to index the repository it will tell you Unable to update index for EclipseLink Repo|http://download.eclipse.org/rt/eclipselink/maven.repo.
But if you also include into the pom.xml this:
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
it will do the work and add the dependency.
Not ideal but works.
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
...
<repository>
<id>EclipseLink Repo</id>
<url>http://repo.maven.apache.org/maven2</url>
</repository>
The following configuration in ivy-setting.xml worked fine for me guys:
<resolvers>
<url name="eclipselink" m2compatible="true">
<artifact pattern="http://mirrors.ibiblio.org/pub/mirrors/eclipse/rt/eclipselink/maven.repo/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
</url>
</resolvers>
All broken. I get 404s everywhere. And the Nexus instance has not indexed the latest releases. Thank you very much for chaotic distribution managment (the project should really be relocated to Apache)
However, manual digging lead to:
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.3.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>EclipseLink Repo</id>
<url>http://maven.eclipse.org/nexus/service/local/repositories/Sonatype/content</url>
</repository>
</repositories>
Again, this is not working 100% perfectly because Maven is not able to find dependency information.
Hmmm... maybe I should think again before using software that is obviously maintained in such an amateurish manner.

How to specify a repository for a dependency in Maven

In projects with several dependencies and repositories, the try-and-error approach of Maven for downloading dependencies is a bit cumbersome and slow, so I was wondering if there is any way to set an specific repo for some declared dependencies.
For example, I want for bouncycastle to check directly BouncyCastle's Maven repo at http://repo2.maven.org/maven2/org/bouncycastle/ instead of official Maven.
Not possible. Maven checks the repositories in their declaration order until a given artifact gets resolved (or not).
Some repository manager can do something approaching this though. For example, Nexus has a routes feature that does something equivalent.
I have moved libraries from 3rd party repositories to their own project and included this project as first module in my base project:
base/pom.xml
...
<modules>
<module>thirdparty</module>
<module>mymodule</module>
...
</modules>
base/thirdparty/pom.xml:
...
<artifactId>thirdparty</artifactId>
<packaging>pom</packaging>
<repositories>
<repository>
<id>First thirdparty repository</id>
<url>https://...</url>
</repository>
...
</repositories>
<dependencies>
<dependency>
<!-- Dependency from the third party repository -->
</dependency>
....
</dependencies>
base/mymodule/pom.xml:
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>thirdparty</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
...
</dependencies>
This will ensure that the libraries from the thirdparty repository are downloaded into the local repository as soon as the root project is build. For all other dependencies the repositories are not visible and therefore not included when downloading.
This post could be very old but might be useful to someone. I specified the two repositories in pom.xml like below and it worked.
<repositories>
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>http://repository.aspose.com/repo/</url>
</repository>
<repository>
<id>Default</id>
<name>All apart from Aspose</name>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
</repositories>