Gradle cannot find Maven parent dependency with version RELEASE - maven

I've got a "project B" with a pom.xml like this:
<parent>
<groupId>org.company</groupId>
<artifactId>projectA</artifactId>
<version>RELEASE</version>
</parent>
<artifactId>projectB</artifactId>
<version>0.0.1</version>
where "project B" has "project A" as parent project pom.
I am trying to create a new "project C" using gradle now and if I want to use "project B" as a dependency, I specify build.gradle like this :
repositories {
maven {
url "http://mycompany:8081/artifactory/repository"
}
}
dependencies {
compile group: 'org.company', name: 'projectB', version: '0.0.1'
}
But I get the following error:
Could not resolve org.company:projectB:0.0.1.
Could not parse POM http://company:8081/artifactory/repository/org/company/projectB/0.0.1/projectB-0.0.1.pom
Could not find org.company:projectA:RELEASE.
Appart from setting my projectA version number to an specific one, is there a way to make this build work with gradle?
Is there a way gradle could find the correct version like maven is doing right now? My other maven projects have no problem finding the correct version.
I do not want to get the latests version of project A, maybe downloading the full project B jar would be enough.
P.D I am using gradle version 4.5 and maven version 3.5.2 on my local computer

I would do the following:
Download the jar and pom of projectB from your artifactory.
Change the pom by replacing "RELEASE" by a concrete version and the version tag of projectB by something new (like replacing version 1.2.3 by 1.2.3-manipulated).
Upload the jar and the new pom to your artifactory.
Reference version 1.2.3-manipulated from Gradle.
AFAIK you do not need to change the original jar or its content, it is enough to change and redeploy the pom file (with a different version that indicates your manipulation).

Related

Getting an error "Missing artifact com.beust:jcommander:jar:1.66" in maven pom.xml file.Any suggestion how to resolve this?

I have added the required dependencies in maven pom.xml file.
Downloaded the dependencies in pom.xml file via Maven Install option
Updated the project.
After updating the project, i found the error message "Missing artifact com.beust:jcommander:jar:1.66" in pom.xml file.
I have tried including the dependency of jcommander 1.66 version in pom.xml file but there is no change.
Any suggestions would be of great help. Thanks
Maven does not only need the dependencies in your POM, but also the transitive dependencies, i.e. their dependencies, the dependencies of their dependencies and so on.
This is why you let Maven connect to standard Maven repositories like MavenCentral. Except for unavailable artifacts, manual installation of artifacts should be avoided.

How to get which dependency and dependency version will pack into war file in gradle build file?

I want to print all dependency groupId, artifactId and version which will pack into war package in multiple module gradle project.
What can I do?
You can run the dependencies task on the project that defines the war. And in the linked documentation page has a number of other methods for investigating dependencies of a Gradle project.

Check the spring-data-jpa version in spring-boot-starter-data-jpa

As in question the pom.xml from started does not provide the version information
Using dependency tree we can see versions of all dependencies in the maven project.
mvn dependency:tree -Dverbose
Expand the maven dependencies folder in the project explorer of the IDE.
The version number is present at the end of the file name, like
spring-boot-starter-data-jpa-2.5.5.jar
Here 2.5.5 is the version number of the corresponding file.
There are couple of ways you can find the version.
One option is to verify the version downloaded from you IDE or from you .m2 folder
If you want to know where the version is specified you need to travel through the <parent> tag mentioned in the pom.xml. In the case of Spring Boot Data JPA Starter pom.xml the version is specified in spring-boot-build pom.xml within the properties tag. You can check the below link for the pom.xml definition :
spring-boot-build pom.xml

How to build maven project With existing jar in local maven repository

I have issue with Project Building in Maven. I have updated some code in one of the dependency jars which is available in Maven Repository .I need to build my project with the jar i have modified.How to do that .Kindly Help me.
1. Install mvn project
Make sure to install your changed code into your repository.
Run following maven command for your updated library project.
mvn install
2. Check dependency
Check if the version of your library project match with the dependency entry in your main project pom.
E. g. if you install version "1.1" make sure the dependency entry is also "1.1"

TinyRadius maven repository

I am looking for Latest TinyRadius maven repository artifact id
Can any one tell me the dependency information for TinyRadius jar so that I can add to my pom.xml
The pom from the latest TinyRadius release (which is 1.0) contains the following information:
<groupId>org.tinyradius</groupId>
<artifactId>tinyradius</artifactId>
However it also has the following information:
<version>0.9.9</version>
So the version in the pom doesn't match the actual release which contains the pom. I also can not find this artifact in any maven repository under this groupId and artifactId, but these are the only values that they could be - based on the pom at least.
You could simply download the jar from sourceforge and then manually include it in your pom from your local drive or maven repository - see this question for details on:
Maven: Including jar not found in public repository

Resources