Missing pom spring-boot-dependencies - maven

There is a pom, pom.md5 and pom.shal missing for the latest version of the
spring-boot-dependencies.
http://repo.spring.io/snapshot/org/springframework/boot/spring-boot-dependencies/2.0.0.BUILD-SNAPSHOT/
Not quite sure if this is the right way - but could somebody put them there or change the maven-metadata.xml to point at the former Build?
Edit:
Error during build process
Failed to collect dependencies at org.springframework.statemachine:spring-statemachine-core:jar:2.0.0.BUILD-SNAPSHOT: Failed to read artifact descriptor for org.springframework.statemachine:spring-statemachine-core:jar:2.0.0.BUILD-SNAPSHOT: Could not find artifact org.springframework.boot:spring-boot-dependencies:pom:2.0.0.BUILD-20171005.042611-1 in spring.io.snapshot (http://repo.spring.io/snapshot) -> [Help 1]
Thanks
Edit2:
For the time being - until the issue is fixed - I did the following (not nice but works):
Excluded the spring-boot-dependencies in all the dependencies that have remotely something to do with spring boot.
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
</exclusion>
</exclusions>
Added the spring-boot-dependencies dependency from maven central.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.0.M3</version>
<type>pom</type>
<scope>import</scope>
</dependency>

Related

Using dependencies of an artifact

I have a complex Spring project with tens of dependencies and modules. I notice that some of them might be replaced by spring-boot-starters.
However, when I'm replacing some dependencies with starters in main, parent pom, I'm getting errors in children modules.
Here's an example:
PARENT POM
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
<version>2.0.5.RELEASE</version>
</dependency>
</dependencies>
</dependencyManagement>
MODULE POM
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
According to maven repository spring-boot-starter-activemq depends on, among others, spring-boot-starter and spring-jms.
Should these dependencies be available for modules?
Is there a way to use dependencies like that? I would make pom files shorter.
Or maybe is it a bad idea to do it like that and I should define all dependencies I will use in dependencyManagement?
In a POM, you should have all the dependencies that you directly use in your code. Do not rely on transitive resolution for things you actively use.
Your construction does not work because you did not manage the spring-jsm and spring-boot-starter in your dependencyManagement. Being a dependency of the managed dependency does not help.

Excluding transitive dependency from Maven pom

I have a Maven dependency added where type is test-jar and scope is test. I want to remove a transitive dependency from this (because in the Nexus prod repo this dependency is missing which leads to Jenkins build failure). I have added a exclusion tag but still the dependency is not removed i.e. Jenkins build still fails and complains about this dependency. Any clue why?
<dependency>
<groupId>com.xxx</groupId>
<artifactId>xxx</artifactId>
<type>test-jar</type>
<version>${xxx.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>jamon</artifactId>
<groupId>com.jamonapi</groupId>
<!-- <scope>compile</scope> -->
</exclusion>
</exclusions>
</dependency>
You can use the following command to find out the transitive dependency details and then you can exclude the dependency:
mvn dependency:tree -Dverbose -Dincludes=<artifact_name>

How to resolve Could not find artifact commons-math3:commons-math3:jar:3.4.1

I have a project that executes a JMeter tests suite though maven.
I use com.lazerycode.jmeter s jmeter-maven-plugin.
With version 2.0.3 my project runs well. but when I update teh plugins version to 2.1.0 the following error is thrown.
[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:2.1.0:configure (configure) on project my-regression: Could not find artifact commons-math3:commons-math3:jar:3.4.1 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
I know by going through articles like this, that this can be resolved by excluding the dependencies.
but its just I don't know how to configure that dependency.
I tried the below.
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>commons-math3</groupId>
<artifactId>commons-math3</artifactId>
<version>3.4.1</version>
<exclusions>
<exclusion>
<groupId>commons-math3</groupId>
<artifactId>commons-math3</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
Which didn't work.
Will be glad to provide more info.
Use version 2.6.0 of the plugin and add under configuration node:
<excludedArtifacts>
<exclusion>commons-pool2:commons-pool2</exclusion>
<exclusion>commons-math3:commons-math3</exclusion>
</excludedArtifacts>

Cannot use dependency jboss-javaee-6.0 in my Maven project

I have set up a maven project with JBoss 7.1.1 and I want to use JavaEE libraries.
In the root pom.xml I have set:
<repositories>
<repository>
<id>jboss</id>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
</repositories>
I have this in the root pom.xml and and in the ejb maven module´s pom.xml:
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>3.0.2.Final</version>
<scope>provided</scope>
<type>pom</type>
</dependency>
When I do a maven clean install I get this error:
Failed to execute goal on project myproject-ejb: Could not resolve dependencies for project myproject:myproject-ejb:ejb:1.0-SNAPSHOT: Failure to find org.jboss.spec:jboss-javaee-6.0:jar:3.0.2.Final in https://repository.jboss.org/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss has elapsed or updates are forced -> [Help 1]
What´s up with my configuration?
EDIT 1
If I remove the jboss repository from the root pom.xml I get this error:
[ERROR] Failed to execute goal on project myproject-ejb: Could not resolve dependencies for project myproject:myproject-ejb:ejb:1.0-SNAPSHOT: The following artifacts could not be resolved: org.jboss.spec:jboss-javaee-6.0:jar:3.0.2.Final, xalan:xalan:jar:2.7.1.jbossorg-2: Could not find artifact org.jboss.spec:jboss-javaee-6.0:jar:3.0.2.Final in central (http://repo.maven.apache.org/maven2) -> [Help 1]
This is caused by a bug in Xalan POM file. The following workaround fixed the problem for me:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>3.0.2.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<!-- Required by jboss-javaee-6.0:3.0.2.Final (https://issues.jboss.org/browse/JBBUILD-708) -->
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
The given dependency for jboss-javaee-6.0 is available from Maven Central so there is no need to give a separate repository.
Based on the error message you need to delete a particular location from your location maven repository (usually in $HOME/.m2/repository) in this case the folder org/jboss/. Afterwards you need to rebuild your project.
This worked for me:
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-all-6.0</artifactId>
<version>3.0.2.Final</version>
<scope>provided</scope>
</dependency>
But I see here that something like the following may also work:
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-web-6.0</artifactId>
<version>2.0.0.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>

Dependency conflicts on maven

If I have some libs that have others dependencies in different versions like this example: commons-logging-1.0.4.jar (omitted for conflict with 1.1.1) and commons-logging-1.1.1.jar.
What´s the best practice about this, inform the exclusion of this conflict in the related dependency (by tag) or do nothing because the lib was omitted? Is there any problem don´t especify the exclusion of dependencies in the POM ?
Example that explain that how to resolve this in the POM, I´m putting the following instruction to resolve the internal conflicts about version:
<dependency>
<groupId>struts</groupId>
<artifactId>struts</artifactId>
<version>1.2.8</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
You need to configure a dependencyManagement section in your [parent] POM. This will coerce artifacts coming as transitive dependencies to be of the specified version.

Resources