Two maven dependencies from different repos - java

How can i use selenium and sikuli in one pom.xml ?
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.45.0</version>
</dependency>
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
sikuli is in :
<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>
but adding this repo, makes maven to look there for selenium too
is it possible to link two different dependencies from two different repositories ?

Maven looks for artifacts (selenium, sikulixapi, ..) in all defined repositories.
You can define two: com.sikulix and the standard one:
<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>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>

Related

Error in downloading dependency from 2 mirrors in Maven

I want to download spring-native dependency from maven mirror as it is not in my third party mirror.I tried to do it by including maven mirror in my settings.xml file,but it doesn't work.
Settings.xml file-
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<mirrors>
<mirror>
<id>artifactory</id>
<mirrorOf>*</mirrorOf>
<url>https://thirdparty.com/artifactory</url>
</mirror>
<mirror>
<id>MavenCentral</id>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>artifactory</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>MavenCentral</id>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
I added this dependency-
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-native</artifactId>
<version>0.9.2</version>
</dependency>
Issue-
Cannot resolve org.springframework.experimental:spring-native:0.9.2
How can I resolve this?
When you use <mirrorof>*<mirrorof> then you essentially override all other mirrors and repository definitions. To exclude repositories from the mirror, use
*,!otherrepo

Spring Framework Maven Difference

I am currently involved in a project managed by maven and the project structure is a mess. So I tried to update the pom files and settings.xml first.
However after I switched in settings.xml:
<repository>
<id>Spring IO Releases</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>Spring IO Snapshots</id>
<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
to:
<repository>
<id>Spring IO Snapshots</id>
<url>http://repo.spring.io/libs-snapshot/</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>Spring IO Releases</id>
<url>http://repo.spring.io/libs-release/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
And changed my dependency from:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.XXX</artifactId>
<version>${spring-version}</version>
</dependency>
to
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-XXX</artifactId>
<version>${spring-version}</version>
</dependency>
However it didn't work. What is the difference between these two dependencies?
I have checked inside the Jar files and only obvious thing is springframework.XXX artifacts are build 1 month before spring-XXX artifact contents.

Maven activeProfiles are ignored?

I use for Eclipse a maven settings.xml that has a 3rd-party Artifactory location from which Maven artefacts are retrieved.
We added now an own Artifactory which hosts artefacts not contained in the former Artifactory.
We added new profiles to the settings.xml and activated them.
What happens now, if artefacts shall be retrieved that are only in the new one, the maven build fails with an artefact not found exception.
Looking through the debug-output it seems like Maven never tries to access the new location.
As test, we deactivated the profiles of the 3rd-party Artifactory. Now the debug-log shows that Maven tries to access our Artifactory (but only if there are no other locations than ours).
Has someone an idea why the new Artifactory is ignored if the other profiles are active?
Below is my settings.xml, the upper two "ltl-*" profiles are the new ones which seems to be not used.
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>ltl-releases</id>
<repositories>
<repository>
<id>ltl-releases</id>
<url>http://134.91.18.140:8081/artifactory/releases</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>ltl-snapshots</id>
<repositories>
<repository>
<id>ltl-snapshots</id>
<url>http://134.91.18.140:8081/artifactory/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>ukp-oss-releases</id>
<repositories>
<repository>
<id>ukp-oss-releases</id>
<url>http://zoidberg.ukp.informatik.tu-darmstadt.de/artifactory/public-releases/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>ukp-oss-releases</id>
<url>http://zoidberg.ukp.informatik.tu-darmstadt.de/artifactory/public-releases/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>ukp-oss-snapshots</id>
<repositories>
<repository>
<id>ukp-oss-snapshots</id>
<url>http://zoidberg.ukp.informatik.tu-darmstadt.de/artifactory/public-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>ltl-releases</activeProfile>
<activeProfile>ltl-snapshots</activeProfile>
<activeProfile>ukp-oss-releases</activeProfile>
<!-- Uncomment the following entry if you need SNAPSHOT versions. -->
<activeProfile>ukp-oss-snapshots</activeProfile>
</activeProfiles>
</settings>

Can't find the maven repository for xwiki xmlrpc

I want to include this library:
import org.xwiki.xmlrpc.XWikiXmlRpcClient;
so I am using this maven snippet to include it:
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-core-xmlrpc-client </artifactId>
<version>2.1.1</version>
</dependency>
I can't find the library anywhere though. We use Artifactory which queries the main maven repo for unresolved dependencies. I can find the jar online, but I need a maven repository to include it in the build process.
Do I need to add a special repo or something?
A list can be found at at their website :
<repositories>
<repository>
<id>xwiki-snapshots</id>
<name>XWiki Nexus Snapshot Repository Proxy</name>
<url>http://nexus.xwiki.org/nexus/content/groups/public-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>xwiki-releases</id>
<name>XWiki Nexus Releases Repository Proxy</name>
<url>http://nexus.xwiki.org/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>xwiki-plugins-snapshots</id>
<name>XWiki Nexus Plugin Snapshot Repository Proxy</name>
<url>http://nexus.xwiki.org/nexus/content/groups/public-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>xwiki-plugins-releases</id>
<name>XWiki Nexus Plugin Releases Repository Proxy</name>
<url>http://nexus.xwiki.org/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

How to direct maven to download Apache commons-io-2.4.jar?

I am trying to get Apache commons-io-2.4.jar installed directly using maven.
The POM snippet is as follows. Can anyone help me make it work?
POM Snippet:
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
</dependencies>

Categories

Resources