Spring Framework Maven Difference - java

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.

Related

Maven plugin dependencies couldn't resolve dependency from internal repo

I am creating parent-pom. There we are defining build->plugin->dependencies.
It can fetch dependencies from maven but it couldn't fetch dependencies from our internal Maven repository. getting below error
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-antrun-plugin:1.2:check (validate) on
project parent-pom: Execution validate of goal
org.apache.maven.plugins:maven-antrun-plugin:1.2:check failed: Plugin
org.apache.maven.plugins:maven-antrun-plugin:1.2 or one of its
dependencies could not be resolved: Could not find artifact
org.tools:build-tool:jar:1.0 in central
(https://repo.maven.apache.org/maven2) -> [Help 1]
It is trying to pull dependency from https://repo.maven.apache.org/maven2 instead of our internal Maven repository. I have configured repositories and dependencyManagement still it is trying to fetch from https://repo.maven.apache.org/maven2 instead of going to our internal repositories.
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>org.global</groupId>
<artifactId>parent-pom</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<repositories>
<repository>
<id>archiva.global</id>
<name>Internal Release Repository</name>
<url>https://archiva.global.com/repository/internal</url>
</repository>
<repository>
<id>archiva.snapshots</id>
<name>Internal Snapshots Repository</name>
<url>https://archiva.global.com/repository/snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>archiva.internal</id>
<name>Internal Release Repository</name>
<url>https://archiva.global.com/repository/internal</url>
</repository>
<snapshotRepository>
<id>archiva.snapshots</id>
<name>Internal Snapshots Repository</name>
<url>https://archiva.global.com/repository/snapshots</url>
</snapshotRepository>
</distributionManagement>
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.2</version>
...
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.tools</groupId>
<artifactId>build-tool</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
...
</project>
Is there anything I missed? Only build plugin dependencies are not resolved where as project dependencies are getting resolved from our internal repository.
It is the default behavior of maven.
When defining <repository> .... </repository> make sure to override the <id>central</id> with your internal repository. If you don't do so, maven will still contact maven central to resolve dependencies and not work without proper proxy settings if you are behind a VPN. The below listing will fetch all your deps from your internal repository.
<repositories>
<repository>
<id>central</id>
<name>Internal Release Repository</name>
<url>https://archiva.global.com/repository/internal</url>
</repository>
<repository>
<id>archiva.snapshots</id>
<name>Internal Snapshots Repository</name>
<url>https://archiva.global.com/repository/snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
For downloading the plugins from your internal repository
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Internal Repo</name>
<url>https://archiva.global.com/repository/internal</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>

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>

Two maven dependencies from different repos

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>

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