Maven: Ignore a specific artifact without failing the build - java

I am trying to build Apache CXF locally. It does not work behind a maven proxy (e.g. JFrog Artifactory), because CXF's transitives dependencies contain a dependency with an invalid pom.xml file:
[ERROR] Failed to execute goal on project cxf-rt-transports-jms: Could not resolve dependencies for project org.apache.cxf:cxf-rt-transports-jms:bundle:3.4.0-SNAPSHOT: Failed to collect dependencies at org.apache.activemq:activemq-pool:jar:5.15.9 -> org.apache.activemq:activemq-jms-pool:jar:5.15.9 -> org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec:jar:1.0.1: Failed to read artifact descriptor for org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec:jar:1.0.1: Could not transfer artifact org.apache.geronimo.specs:specs:pom:1.1 from/to nexus-central (https://myrepo.local/maven-central/): Failed to transfer file https://myrepo.local/maven-central/org/apache/geronimo/specs/specs/1.1/specs-1.1.pom with status code 409 -> [Help 1]
Artifactory will deliver a 409 if it cannot parse the XML file. In this case, the artifact is apache.geronimo.specs:specs:pom:1.1. If you take a look at the XML file, you'll find it is invalid indeed: https://repo1.maven.org/maven2/org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
After line 89 (closing </developers>), there is an extra `.
I opened an issue at apache to fix their build: https://issues.apache.org/jira/browse/CXF-8101
In the mean time, I'd like to work with CXF to create a patch an contribute.
Things I tried:
Install the dependency manually => failed because mvn still looks for updates
No proxy => not an option for me :(
Add some excludes locally on the parent/pom.xml => didn't help, I will never be able to catch them all (transitive dependencies…).
Forcing the offending artifacts' version to 1.2. Did not help either, because some projects wil still rely on a specific version.
That said, what are my options?
Thanks in advance,
Ben

You can try:
Download org/apache/geronimo/specs/specs/1.1/specs-1.1.pom into your local .m2 path and fix the error.[You need to be sure all dependencies are available in your local repository]
Try to build with maven command: -o (offline)
If -o doesn't help, try with -nsu,--no-snapshot-updates (Suppress SNAPSHOT updates)
Hope it helps you.

Related

while adding poi -ooxml dependency in sts4 I am getting an error - cannot transfer

I am getting an error while adding poi - ooxlm dependency in my Rest assured project . I need to add Excel file interaction to handle data .
The error I am getting is "Could not transfer artifact org.apache.poi:poi-ooxml-lite:jar:5.2.2 from/to snapshots (https://artifacts.apple.com/libs-snapshot): artifacts.apple.com org.eclipse.aether.transfer.ArtifactTransferException: Could
not transfer artifact org.apache.poi:poi-ooxml-lite:jar:5.2.2 from/to snapshots (https://artifacts.apple.com/libs-snapshot): artifacts.apple.com at "
my pom.xml is
You don't show much of the relevant parts of your pom.xml; also including the relevant snippets as text is easier than a screenshot.
But org.apache.poi:poi-ooxml-lite is available on maven central, so that's where your project should look.
https://artifacts.apple.com/libs-snapshot does not resolve for me, this might be a company internal maven repository that you're using?
There are a few things you can check:
Open the file .m2\repository\org\apache\poi\poi-ooxml-lite\5.2.2\poi-ooxml-lite-5.2.2.jar.lastUpdated and check the error message for each repository. Check why it can't reach maven central; is it missing from the list or giving an error? This might be a company firewall/policy issue perhaps? Or is it giving an error on HTTPS/TLS protocol level?
Check with mvn help:effective-pom what your current listed (plugin) repositories are
Check if you can add maven central to your repositories list if it's missing somehow (should be included by default). Check if it's HTTP or HTTPS, only secure is supported now.
Check in your main maven repository which versions of this jar are available / mirrored, and depend on that version instead (if you can't get maven central to work).
Run your maven command with -X for debug mode to investigate further

Netbeans 8.0.2 fail to run a simple hello world program

Showing an error of the sorts
Plugin org.codehaus.mojo:exec-maven-plugin:1.2.1 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.codehaus.mojo:exec-maven-plugin:jar:1.2.1:
Could not transfer artifact org.codehaus.mojo:exec-maven-plugin:pom:1.2.1 from/to central (http://repo.maven.apache.org/maven2):
Failed to transfer file:
http://repo.maven.apache.org/maven2/org/codehaus/mojo/exec-maven-plugin/1.2.1/exec-maven-plugin-1.2.1.pom. Return code is: 501 , ReasonPhrase:Not Implemented. -> [Help 1]
This might be an issue with resolving the dependency. Can you try below and get back.
Open the .m2/repository and proceed to the path org/codehaus/mojo/exec-maven-plugin/. Then delete the subdirectory 1.2.1 and the entire content. Then the maven will automatically download the dependency in the next update. Try to build the project and see.
Additionally you can try to issue below command in command prompt at the project directory.(This command will update the dependencies forcefully)
mvn clean install -U

Failed to execute goal on project.. Failed to read artifact descriptor for error in IntellJ

I imported my project and when did a maven clean build was successful, but when maven install is done this Build Failure occurs.
I have my maven in C\maven\maven 3.6 and I have given the settings and repo location of that location to this project.
My Env variables are correctly set up with reference to Java and Maven as well. Please help me on this to get it solved.
it may be because of the proxy ! Check you proxy and test if it's working.

How to run spring project offline mode?

I am trying to run a Spring Project, with several dependencies, that I have already downloaded into my local repository, and have also done followings :
Added local repository path in setting.xml in localRepository tag.
Running the project using mvn install -nsu -llr -o , for offline mode.
And I am getting following error :
[ERROR] Failed to execute goal on project file2Json: Could not resolve
dependencies for project
com.nse.file2Json:file2Json:jar:0.0.1-SNAPSHOT: Cannot access central
(http://repo1.maven.org/maven2) in offline mode and the artifact
com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.8.4 has
not been downloaded from it before. -> [Help 1]
I have the dependency installed, take a look :(
I have following questions :
Why is the project is trying to look into http://repo1.maven.org/maven2 when I am using offline mode ?
How can I run the project offline, by providing the required dependencies at required paths ?
Please help !
thanks in advance.
It says it cannot access Maven Central because you are in offline mode. And it tries to look there, because ´jackson-dataformat-csv` is not in your local repository, so Maven needs to get it from somewhere (and Maven Central is the default repository).
What you need to do is to execute mvn dependency:go-offline before you switch to the offline mode. This will download everything that you need (dependencies, transitive dependencies as well as plugins).

Android roboquice transient dependency

I got that error from jenkins running mvn clean install on Parent pom. But I can not reproduce it on my local env because when I run it on local everything works fine. Maybye someone had such problem. Thanks in advance for your advices.
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:apk (default-apk) on project RondoAndroid: Error while processing transient dependencies: Failed to collect dependencies at org.roboguice:roboguice:jar:3.0b-experimental -> android.support:compatibility-v4:jar:11: Failed to read artifact descriptor for android.support:compatibility-v4:jar:11: Could not transfer artifact android.support:compatibility-v4:pom:11 from/to third.party.closed.source.repo (file://${basedir}/../maven_repo_3rd_party): Repository path /../maven_repo_3rd_party does not exist, and cannot be created.
I wrote email to the author of RoboGuice. He said that 3.0b-experimental should be replaced by 2.0 version. This is stable version valid for use. After I apply that solution everythink works fine. I hope that might help somebody.

Categories