mvn- look for wrong url in maven repositories - maven

When I run mvn package to compile a maven project it downloads the jar file from
wrong URLs. It adds org/dnosproject/ to the URL which is wrong.
Downloading: https://mvnrepository.com/artifact/io.github.dnos-project/dnos-lib-all/org/dnosproject/onos-port-protobuf/1.1.5/onos-port-protobuf-1.1.5.jar
<repositories>
<repository>
<id>dnos-lib-all</id>
<name>dnos-lib</name>
<url>https://mvnrepository.com/artifact/io.github.dnos-project/dnos-lib-all</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.github.dnos-project</groupId>
<artifactId>dnos-lib-all</artifactId>
<version>1.1.5</version>
</dependency>

The website mvnrepository.com is a kind of search engine across multiple real Maven repositories. If you look at the link you mentioned in your <repository/> configuration, you'll notice they list that dependency as available in "Central", in fact here. "Central" is configured by default, so you don't need a <repository/> configuration for this dependency. Instead, you just need the correct <dependency/> entry:
<dependency>
<groupId>io.github.dnos-project</groupId>
<artifactId>dnos-lib-all</artifactId>
<version>1.1.5</version>
</dependency>
You already had this in the snippet you posted, so just removing the <repository/> configuration should do the trick.

Related

How can I use Maven locations in Eclipse Target files that come from custom repositories

I am trying to use a maven location in a Tycho build, that comes from a different repository than maven central. Below is the part of the definition that provides this on PDE. Tycho does not seem to honour the repository declaration and fails on resolution. Assuming I am observing this correctly, I have the following
Question: How can I hint Tycho to understand that these maven coordinates should be obtained from the associated repositories?
If this is not a current feature, but there is an issue, please comment as well, so this can be found and tracked.
<location includeDependencyScope="compile" includeSource="true" missingManifest="generate" type="Maven">
<dependencies>
<dependency>
<groupId>com.github.amlorg</groupId>
<artifactId>amf-api-contract_2.12</artifactId>
<version>5.0.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.raml</groupId>
<artifactId>webapi-parser</artifactId>
<version>0.5.0</version>
<type>jar</type>
</dependency>
</dependencies>
<repositories>
<repository>
<id>mulesoft.releases</id>
<url>https://repository-master.mulesoft.org/nexus/content/repositories/releases</url>
</repository>
<repository>
<id>mulesoft.public</id>
<url>https://repository.mulesoft.org/nexus/content/repositories/public/</url>
</repository>
</repositories>
</location>

spring use library version not in the mvn repository

I'm trying to use spring-session-jdbc:2.0.0.RC2 which is not listed in https://mvnrepository.com/artifact/org.springframework.session/spring-session-jdbc/1.3.1.RELEASE
spring session github has newer version than mvnrepository.
How can I add the dependency of the new version in the pom.xml file?
To obtain dependencies that aren't on the central mvn repository, you must communicate to your project that you need it to point to an additional repository. In your case, this snippet, added to your pom, should do:
<repositories>
<repository>
<id>spring-milestone-repository</id>
<name></name>
<url>http://repo.spring.io/milestone/</url>
</repository>
</repositories>
After declaring this, you just add this to your dependencies, and it will be downloaded:
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-jdbc</artifactId>
<version>2.0.0.M2</version>
</dependency>

Why do I need PrimeFaces Maven Repository to use a theme?

Why do I need PrimeFaces Maven Repository, when using all-themes dependency from PrimeFaces?
When I just use one dependency I got no errors and can work.
But when I use all-themes I get missing artifact org.primefaces.themes:all-themes.jar:1.0.10, but why?
<repositories>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
</repositories>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.0</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.10</version>
</dependency>
Maven's default repository is "maven central". There are a lot of artifacts in there, but some vendors may not have put their artifacts there and primefaces is one of them. Maven will look for the jar in maven central and won't find it. If you don't specify that it should also look in the Primefaces Maven Repository (which does have the artifact), it can't find the artifact.
The PrimeFaces people have decided not to deliver their packages into Maven central so that's the reason why you need to define the prime faces repository separately.
For such purposes it's a good idea to start using a repository manager which can be configured in a central location for your company to use PrimeFaces repository as well. This will make life easier.
Question:
But when I use all-themes I get missing artifact org.primefaces.themes:all-themes.jar:1.0.10, but why?
Answer:
Because the version of PrimeFaces all-theme you are using it does not exist in Maven repo. Currently Maven has 1.0.8 version as latest.
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.8</version>
</dependency>
Maven Repo
Alternatively, you can use single themes from Icefaces
<dependency>
<groupId>org.icefaces.ace-themes</groupId>
<artifactId>ace-sunny</artifactId>
<version>4.1.0</version>
</dependency>
In your XHTML page include the style:
<h:outputStylesheet name="theme.css" library="ace-sunny"/>
We can only guess why this solution was chosen back then. Currently there is no need to a custom repository for themes. They are simply built-in, or, in case of premium themes, you will need to add the resources to your project yourself.
See https://primefaces.github.io/primefaces/12_0_0/#/core/themes

Error in pom.xml when adding sauce labs dependencies

I am getting errors when I add sauce labs dependency in my pom xml.
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>sauce_testng</artifactId>
<version>1.0.19</version>
</dependency>
Is any one seeing the same issue?
The artifact is stored in the Sauce Labs Maven repository, can you add the following into your pom.xml file?
<repositories>
<repository>
<id>Sauce Maven Repository</id>
<url>https://repository-saucelabs.forge.cloudbees.com/release</url>
</repository>
</repositories>
The artifact that you are referring to is not in central. Are you sure that you have the info?
I have found this info
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>sauce-rest-api</artifactId>
<version>1.1</version>

Apache Airavata dependency in Maven

I'm building a Java application which has a dependency on the Apache Airavata project. I can get it up and running by putting all dependency jar's on the classpath but I have problems setting up the project using Maven.
Problem seems to be some maven repositories are not available. I tried this a couple of months ago with the same result.
Update
I got an answer on the Airavata mailing list that they were aware of the problem, that they supposedly had fixed it and are planning to work away away the dependency. Still, the server does not seem to work:
http://markmail.org/search/+list:org.apache.airavata.users#query:%20list%3Aorg.apache.airavata.users+page:1+mid:y37nleni7hocoftg+state:results
Anyhow, I have now realized that I should use airavata-messenger-client, and that is possible to use with maven with the following dependencies:
<dependency>
<groupId>org.apache.airavata</groupId>
<artifactId>airavata-messenger-client</artifactId>
<version>0.5</version>
</dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
<artifactId>airavata-messenger-commons</artifactId>
<version>0.5</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.6.2</version>
</dependency>
Error message
The container 'Maven Dependencies' references non existing library '[hidden]\.m2\repository\org\apache\airavata\airavata-message-broker\0.5\airavata-message-broker-0.5.jar'
[ERROR] [..] Failed to collect dependencies for [org.apache.airavata:airavata-message-broker:jar:0.5 (compile)]:
Failed to read artifact descriptor for xmlbeans:xbean:jar:2.5.0:
Could not transfer artifact xmlbeans:xbean:pom:2.5.0 from/to ogce.m2.all (http://community.ucs.indiana.edu:9090/archiva/repository/ogce.m2.all):
Connection to http://community.ucs.indiana.edu:9090 refused:
Connection refused: connect
pom.xml
<repositories>
<repository>
<id>repository.apache.org-public</id>
<name>Apache</name>
<url>http://repository.apache.org/content/groups/public</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.airavata</groupId>
<artifactId>airavata-message-broker</artifactId>
<version>0.5</version>
</dependency>
</dependencies>
Airavata has some third party jars pulled from a repo. Please copy paste the following two repos to your pom and see if the problem goes
<repository>
<id>central</id>
<name>Maven Central</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
<repository>
<name>ogce.m2.all</name>
<id>ogce.m2.all</id>
<url>http://community.ucs.indiana.edu:9090/archiva/repository/ogce.m2.all</url>
</repository>

Resources