Why is grails trying to download dependency versions of working#mymachinename? - maven

I have an existing (working) Grails 2.2.2 application. I am attempting to upgrade a dependency to a newer version. When I do this, the build fails with errors stating...
Failed to resolve dependencies
- com.google.guava:guava:working#mymachinename
- org.glassfish.hk2:hk2-api:working#mymachinename
I am really confused as to why Grails is looking for artifacts with a version of 'working#mymachinename'
I am on a private network with its own hosted Artifactory. My BuildConfig.groovy identifies Artifactory and I have successfully pulled in resources in the past.
BuildConfig.groovy
repositories {
mavenRepo name: myRepo, root: <artifactoryUrl>
}
dependencies {
runtime 'com:mydependency:1.0'
}
I can browse Artifactory and find both missing resources but with valid version numbers, 14.0.1 and 2.2.0-b10 respectively.
Has anyone seen anything like this before? Why is grails trying to download dependency versions of working#mymachinename?

Related

Gradle artifactory plugin not resolving JAR dependencies

I am upgrading my build to Gradle 7.4.2 running with Java 11 and use Artifactory as my repository. I am using the latest Gradle Artifactory Plugin and my builds are failing to resolve JAR dependencies now.
In Artifactory I'm using a virtual repository to resolve dependencies like Apache Commons Text as well as my own local collection of JARs that I've deployed to a separate Artifactory repository that is connected to the virtual repository.
My build was resolving my JAR dependencies fine under Gradle 5.6.4/Java8. Now my build fails with errors like this.
Resource missing. [HTTP GET: https://artifactory.myco.com:443/artifactory/collective-gradle-virtual/com/myco/a/myjni/2.5-AABBCC/myjni-2.5-AABBCC.pom]
Resource missing. [HTTP GET: https://artifactory.myco.com:443/artifactory/collective-gradle-virtual/com.myco.a/myjni/ivy-2.5-AABBCC.xml]
The final build error message said something similar:
> Could not find myco.com.a:myjni:2.5-AABBCC.
Searched in the following locations:
- https://artifactory.myco.com:443/artifactory/collective-gradle-virtual/com/myco/a/myjni/2.5-PH44157/myjni:2.5-AABBCC.pom
- https://artifactory.myco.com:443/artifactory/collective-gradle-virtual/com.myco.a/myjni/ivy-2.5-AABBCC.xml
Required by:
project :MyJAR
Is there some change between Gradle/the Gradle Artifactory Plugin/Java 11 such that the build can no longer resolve JAR artifacts?
I even tried creating a myjni-2.5-AABBCC.pom file and deployed it to the same path as the JAR. That fails too because the repository has the JAR and POM in com.myco.a and the resolver is looking for it in com/myco/a.
I also changed my dependencies to append #jar at the end in the hopes that would change the resolver behavior. It did not.
My dependency looks like this:
dependencies {
implementation 'com.myco.a:myjni:2.5-AABBCC#jar'
}
My artifactory block is this:
artifactory {
contextUrl = "https://artifactory.myco.com:443/artifactory"
resolve {
repository {
repoKey = 'collective-gradle-virtual'
username = "${artifactoryUser}"
password = "${artifactoryKey}"
maven = true
}
}
}
Update 1
I discovered that even though my existing setup worked fine before the upgrade, for some reason now, it requires a POM file to exist with the actual JAR. I also suspect that the use of dots in the group name is causing problems with locating the POM file. So I'm renaming those groups to not have dots.
UPdate 2
I restructured my repository to change the dotted group name in the repository to a maven-style directory tree and added a POM for each dependency. Now the dependencies resolve, but I don't understand why the behavior changed when I upgraded Java, Gradle and the Gradle Artifactory Plugin.

AEM Mocks missing artifact for latest version

I have added the latest version of AEM Mocks (2.7.2) as a Maven dependency in my AEM project. When I try to build my project, I get an error saying that this artifact cannot be found: com.day.commons:day-commons-gfx:jar:2.1.28. So I looked online, found it and added it as a dependency. But now I get the same error when trying to build. Does this artifact still exist? When trying various recent versions of AEM Mocks, I found that they all depend on this missing artifact.
For now, I downgraded to version 2.3.0, which works fine without that artifact but I would like to use the most recent version if possible.
Can anyone please help? Thanks!
This artifact is defined as a workaround, it is explained here in comment:
https://github.com/wcm-io/wcm-io-testing/blob/develop/aem-mock/core/pom.xml#L254:
Workaround for AEM 6.5: The new uber-jar does no longer contain the package com.day.imageio.plugins
It works without any issues for me, so I would check if you have correctly configured Maven repositories. To do it, in your Maven project root type:
mvn help:evaluate
and then:
${project.repositories}
It should list your project effective repositories. Ensure that there is Central Repository (https://repo.maven.apache.org/maven2/) listed. If it is there, then maybe your corporate network cuts requests to external repositories or it was temporarily down.

not able to download inter dependency in maven

I am trying to download dependencies serenity-core 1.9.3 having dependency on asciidoctor-java-integration 0.4 which in turn having dependency on JRuby Complete 1.7.4. My problem is JRuby Complete 1.7.4 is not available in company repository. So it is giving error 403.
Is there any way to configure pom to take available version of JRuby Complete or set pom to download from central maven repository if not available in company repository.

Force Gradle To Resolve Snapshot Dependencies From Different Repo

In my build.gradle for a Java project, I have a list of Maven repositories I am pointing to for dependency resolution, as follows:
repositories {
maven {
url "https://artifactory.myco.com/artifactory/maven-us-east-1-local"
}
maven {
url "https://artifactory.myco.com/artifactory/maven_snapshots-us-east-1-local"
}
mavenCentral() }
It looks like the snapshots repo above barfs during resolution when gradle tries to see if a non-snapshot dependency lives there, as it goes through and contacts each repo in order. In artifactory it has been configured with a policy and it sends back a 409 conflict when it gets asked if it has a non-snapshot dependency. This is what I get:
./gradlew build
.
.
.
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all dependencies for configuration > 'com.myco.project:pgs_common:compile'.
Could not resolve mydep:mydep:1.0.9.
Required by:
com.myco.project:pgs_common:1.28.0-SNAPSHOT
Could not resolve mydep:mydep:1.0.9
Could not get resource 'https://artifactory.myco.com/artifactory/maven_snapshots-us-east-1-local/mydep/mydep/1.0.9/mydep-1.0.9.pom'.
Could not GET > 'https://artifactory.myco.com/artifactory/maven_snapshots-us-east-1-local/mydep/mydep/1.0.9/mydep-1.0.9.pom'. Received status code 409 from server: Conflict
Is there a way in gradle to tell it to not bother contacting that repo for non-snapshot dependencies? In Maven you can add extra properties in a repository declaration telling Maven whether it allows release dependencies, snapshot dependencies, or both (the default).
Thanks.
I have similar issues with Gradle 4.x and 5.x, the workaround is to use Gradle 2.x.
By using Gradle 2.x does not stop Gradle search non-snapshot libs from release repository, but at least Gradle can find decency.

Error downloading artifacts from Maven

I sincerely apologize that I'm not able to copy a stacktrace, but my work is on a private network. On that network is also my Maven repository. We're trying to upgrade to Grails 2.4.3, but the Maven build fails when downloading several of the required jars.
All other jars are downloaded from my private mirror as specified, but for these particular jars, Maven tries to go out to the central repo, which I cannot access. I checked my private repo and those jars with their poms are there. My BuildGroovy.config has the right localRepo specified also.
What's making Maven suddenly connect to repo.maven.apache.org?? I should add that we don't have this problem when upgrading to Grails 2.4.2. That causes another problem (looking for groovy-all-2.4.2?) forcing us to use 2.4.3.
Thanks for ANY help.

Resources