Maven errors and build faliure - maven

The following problem happened: once i opened Eclipe, all the procects were signed with a red X. Opening the projet tree, there was no error sign in the nodes. Nothig showed me what caused the errors. I could not build the projects. Finally i created a new workspace for Eclipse, checked out the projects from SVN, imported them as Maven projects. (There were two main and several child projects.)
Ther are still two projects showing the red X but not showing what causes the errors. I have tried to refresh, clean in Eclipse. I cannot build the other projects without error either, of course also not the ones with errors. The error message is e.g.:
[WARNING] Some problems were encountered while building the effective model for hu.bz.ikti.insurance:SAMCommon:jar:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. # hu.bz.ikti.insurance:InSurance:0.0.1-SNAPSHOT, C:\Dev\workspace\InSurance\pom.xml, line 27, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SAM-függő közös osztályok 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for hu.bz.ikti:common:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.110s
[INFO] Finished at: Fri Jul 12 11:33:33 CEST 2013
[INFO] Final Memory: 4M/114M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project SAMCommon: Could not resolve dependencies for project hu.bz.ikti.insurance:SAMCommon:jar:0.0.1-SNAPSHOT: Could not find artifact hu.bz.ikti:common:jar:0.0.1-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
And for the erroneus project part of the message is:
[ERROR] Failed to execute goal on project Service: Could not resolve dependencies for project hu.bz.ikti.insurance:Service:jar:0.0.1-SNAPSHOT: Failed to collect dependencies for [org.springframework:spring-context:jar:3.1.2.RELEASE (compile), org.springframework:spring-core:jar:3.1.2.RELEASE (compile), org.springframework:spring-beans:jar:3.1.2.RELEASE (compile), commons-dbcp:commons-dbcp:jar:1.4 (compile), postgresql:postgresql:jar:9.1-901-1.jdbc4 (compile), org.springframework:spring-tx:jar:3.1.2.RELEASE (compile), hu.bz.ikti.insurance:Model:jar:0.0.1-SNAPSHOT (compile), org.springframework:spring-orm:jar:3.1.2.RELEASE (compile), hu.bz.ikti:service-base:jar:0.0.1-SNAPSHOT (compile), org.springframework:spring-test:jar:3.1.2.RELEASE (compile), org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 (compile)]: Failed to read artifact descriptor for hu.bz.ikti.insurance:Model:jar:0.0.1-SNAPSHOT: Could not transfer artifact hu.bz.ikti.insurance:Model:pom:0.0.1-SNAPSHOT from/to ikti (https://fcd3.ikti.hu/artifactory/ext-release-local): Failed to transfer https://fcd3.ikti.hu/artifactory/ext-release-local/hu/bz/ikti/insurance/Model/0.0.1-SNAPSHOT/Model-0.0.1-SNAPSHOT.pom. Error code 409, The repository 'ext-release-local' rejected the artifact 'ext-release-local:hu/bz/ikti/insurance/Model/0.0.1-SNAPSHOT/Model-0.0.1-SNAPSHOT.pom' due to its snapshot/release handling policy. -> [Help 1]
Could anyone please help me?
Edited:
What does it mean:
You are trying to deploy a snapshot version (Model-0.0.1-SNAPSHO‌​T.pom) into a releases-only repository ext-release-local ?
Select a snapshot repository (e.g. ext-snapshot-local) instead of a release one.
Should i change my pom.xml? How? I do not understand how is it possible that it earlier worked but now there is this compilation problem. What else could have been changed? I did not change anythig wih intention.
Edited 2
I also noticed that settings.xml under .m2 folder does not exist. Something really went wrong with Maven.

As #user944849 mentioned, 409 is the important part.
You are trying to deploy a snapshot version (Model-0.0.1-SNAPSHO‌​T.pom) into a releases-only repository ext-release-local, thus the conflict.
Select a snapshot repository (e.g. ext-snapshot-local) instead of a release one.

I stumbled over this post with a slightly different problem: we tried to deploy an artifact artifact-1.2.1.jar to a Snapshot repository and got this error:
org.artifactory.api.repo.exception.RepoRejectException: Cannot deploy file
'artifact-1.2.1.jar'. The repository 'repo_snapshot' rejected the resolution
of an artifact 'repo_snapshot:xxx/artifact/1.2.1/artifact-1.2.1.jar' due to
conflict in the snapshot release handling policy.
Problem for us was that SNAPSHOT was not part of the file name of the artifact, so renaming it to artifact-1.2.1-SNAPSHOT.jar solved the issue.

Related

Why deploying maven packages on terminal throws an error but the maven package ends up being published on GitHub packages anyway?

I have been using Clojure, ClojureScript, lein, shadow-cljs, re-frame,
reagent, Emacs, and CIDER to work on a Clojure/ClojureScript dynamic
web app project.
Now, I am trying to make depencies be private Maven packages hosted
for free on GitHub packages. Ok, I managed to publish a package!
After the successful attempt to publish my first maven package, it
ended up with the name of repository-name.repository-name
which looks ugly. As I was trying to tweak it, I ended up changing
this line on my project.clj file:
:pom-addition [:distribution-management [:repository [:id "github"]
[:name "GitHub Packages"]
[:url "https://maven.pkg.github.com/organization-name/repository-name"]]])
Instead of [:url "https://maven.pkg.github.com/organization-name/repository-name"] I
tweaked it to be [:url "https://maven.pkg.github.com/organization-name"].
Now, things got really weird in my opinion.
After executing the terminal command to publish it:
➜ mvn deploy -DaltReleaseDeploymentRepository="${REPO}" -DaltSnapshotDeploymentRepository="${REPO}"
The terminal throws:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.563 s
[INFO] Finished at: 2022-10-28T12:33:16-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project project-name: Failed to retrieve remote metadata project-name:project-name/maven-metadata.xml: Could not transfer metadata project-name:project-name/maven-metadata.xml from/to github (https://maven.pkg.github.com/organization-name): transfer failed for https://maven.pkg.github.com/organization-name/project-name/project-name/maven-metadata.xml, status: 422 Unprocessable Entity -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Now, when I go to https://github.com/orgs/my-organization/packages, the package was indeed published!
And with the name of repository-name instead of repository-name.repository-name.
Why is that so? If the build failed, why is the packaged being published?
Also, what would be standard name for Maven packages on GitHub
packages (especially considering these are Maven packages for a
Clojure project)?

maven copy-dependencies fails on status 403 forbidden

Project I'm working on uses Vaadin framework (old version 7) and java 8. Project is implemented as multiple projects (modules).
Everything worked fine for a few months until yesterday. I did some changes on 'core' part of the project, ran mvn install and jumped into the main project. There I ran
mvn clean
mvn dependency:copy-dependencies
to get my changes and dependencies copied from core to the main project. Last goal (copy-dependencies) always fails with this error
(note that I covered some information in the error message on purpose):
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< myproject.main >-------------------------
[INFO] Building Main version
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from mvn-repository jetty: https://mvnrepository.com/artifact/com/vaadin/addon/jpacontainer/3.1.1/jpacontainer-3.1.1.pom
Downloading from mvn-repository jetty: https://mvnrepository.com/artifact/com/vaadin/addon/vaadin-touchkit-agpl/3.0.0/vaadin-touchkit-agpl-3.0.0.pom
Downloading from mvn-repository jetty: https://mvnrepository.com/artifact/org/vaadin/resetbuttonfortextfield/1.2.1/resetbuttonfortextfield-1.2.1.pom
Downloading from mvn-repository jetty: https://mvnrepository.com/artifact/org/vaadin/addon/confirmdialog/2.1.2/confirmdialog-2.1.2.pom
Downloading from mvn-repository jetty: https://mvnrepository.com/artifact/com/vaadin/tapio/googlemaps/0.6.1/googlemaps-0.6.1.pom
Downloading from mvn-repository jetty: https://mvnrepository.com/artifact/org/vaadin/addons/contextmenu/4.5/contextmenu-4.5.pom
Downloading from mvn-repository jetty: https://mvnrepository.com/artifact/org/vaadin/addons/lazyquerycontainer/vaadin-lazyquerycontainer/7.3.3.6/vaadin-lazyquerycontainer-7.3.3.6.pom
Downloading from mvn-repository jetty: https://mvnrepository.com/artifact/org/vaadin/addons/popupbutton/2.6.0/popupbutton-2.6.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.383 s
[INFO] Finished at: 2021-08-17T11:37:09+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project main: Could not resolve dependencies for project *myproject.core:version*: Failed to collect dependencies at *myproject.core:version* -> com.vaadin.addon:jpacontainer:jar:3.1.1: Failed to read artifact descriptor for com.vaadin.addon:jpacontainer:jar:3.1.1: Could not transfer artifact com.vaadin.addon:jpacontainer:pom:3.1.1 from/to mvn-repository jetty (https://mvnrepository.com/artifact/): authorization failed for https://mvnrepository.com/artifact/com/vaadin/addon/jpacontainer/3.1.1/jpacontainer-3.1.1.pom, status: 403 Forbidden -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
The weird thing is that I don't know about any change in the project or my pc that could cause this issue.
I already tried:
mvn -U dependency:copy-dependencies
running mvn package on before trying to copy dependencies (fails with the same error)
Resetting my Intellij environment
Recompiling every dependent projects
I read the wiki article from the error message but I do not consider it to much use - project work before that without me having to set for example proxy or TLS. Do you have any suggestions on how to solve this problem ?
The problem was indeed in the maven repository link. It seems that the dependencies have changed recently.
In my case the solution was to remove the repository in POM that caused trouble, namely
<repository>
<id>mvn-repository jetty</id>
<url>https://mvnrepository.com/artifact/</url>
</repository>

Maven Jenkins Plugin POMs missing for dependency information on JARs

I have been trying to follow the tutorial here: https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial
I have spent about 7 hours on this now and finally decided to just ask and hope for a response.
I haven't edited the pom file at all from the create command. I am pretty sure I have my settings file correct. When I try to run or package the project though I get this:
[WARNING] The POM for org.apache.maven.surefire:surefire-booter:jar:2.9 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.surefire:maven-surefire-common:jar:2.9 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-toolchain:jar:2.0.9 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.260s
[INFO] Finished at: Tue Jan 29 16:07:56 EST 2013
[INFO] Final Memory: 41M/387M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.9:test (default-test) on project helloworld: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.9:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.9 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven.surefire:surefire-booter:jar:2.9, org.apache.maven.surefire:maven-surefire-common:jar:2.9, org.codehaus.plexus:plexus-utils:jar:2.1: Failure to find org.apache.maven.surefire:surefire-booter:jar:2.9 in http://repo.jenkins-ci.org/public/ was cached in the local repository, resolution will not be reattempted until the update interval of repo.jenkins-ci.org has elapsed or updates are forced ->
So I am assuming that it is supposed to be downloading these 3 jar files from the repositories I set up in the settings file... but it isn't. Is there any reason this would happen? Anything I can do to make it download these files? Or is it downloading them I am just not referencing them correctly somewhere? I'm pretty new to this so i could be completely off.
If it helps I have maven 3.0.4 and jdk 1.7.0_02. Everything else I have pretty much copy and pasted from the tutorial I think. Any help would be greatly appreciated!
Something went probably wrong when you attempted to get the artefacts the first time, and now you are stuck because of a nasty maven bug. Maven might have created an empty folder in your local repository (.m2) and now thinks you already have the dependency. So you should check if this is what happened and, if so, deleted the folder.
See my answer here :
Compiler error "archive for required library could not be read" - Spring Tool Suite
And you can also check why there was a problem in the first place. Do you access the following url with your browser ?
http://repo.jenkins-ci.org/public/org/apache/maven/surefire/surefire-booter/2.9/

Maven missing project required libraries after cloning repo

A team member has shared his project with me on bitbucket and he used maven to manage his dependencies. After cloning the repo (using mercurial) into my workspace (Eclipse) and downloading maven, m2e and all the other required set up files i was able to get all of the project libraries except for 4.
After downloading the project, i ran several mvn commands to clean, install and hopefully download these missing jars. When i ran mvn -e command i get this long error that does nothing to help. Do i have to find and download these 4 jars and put them in my maven repo?
Command output: mvn -e
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.769s
[INFO] Finished at: Mon Apr 09 17:42:17 CDT 2012
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Dugsi_Manager: Could not resolve depen
dencies for project org.bixin.dugsi:Dugsi_Manager:war:0.1.0.BUILD-SNAPSHOT: The
following artifacts could not be resolved: org.eclipse.persistence:eclipselink:j
ar:2.2.0, org.eclipse.persistence:javax.persistence:jar:2.0.3, org.vaadin:icepus
h-gwt:jar:0.1.2, org.jqurantree:jquran:jar:1.0.0: Could not find artifact org.ec
lipse.persistence:eclipselink:jar:2.2.0 in spring-maven-release (http://maven.sp
ringframework.org/release) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
EDIT:
I just need to share my local repository with all other team members that clone my project. External jars that dont use maven have to be manually installed into my local repo, this creates a problem because i cant share my local repo? Any ideas
You can either install these JARs in your local repository, or setup an own (possibly private) maven repository for you to share with your team. Sonatype provides with Nexus OSS an open-source based software to easily set up a repository (which also proxies remote ones if you like).

Get the dependency tree of a maven project with a missing dependency

First of all, let me start by saying mvn dependency:tree does not work in my scenario.
I'm working on an already existing codebase which is giving a build failure. The issue was that the maven repos (including nexus) does not have a POM for a transitive dependency (org.apache.ws.security:wss4j:pom:1.5.2) in this project.
I want to find where this dependency came from. It's probably a transitive dependency, because it isn't listed in the project's pom nor in parent poms. Invoking mvn dependency:tree does not work because it also fails with the same error I get when I use mvn install (Connection timeout). The error is given below.
So, how can I identify which dependency tries to download this pom? I'd like a general answer to find the dependency tree rather than focusing on wss4j pom stated above.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Sample/XKMS 4.5.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://ws.zones.apache.org/repository2/org/apache/ws/security/wss4j/1.5.2/wss4j-1.5.2.pom
[WARNING] The POM for bouncycastle:bcprov-jdk13:jar:132 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:10.155s
[INFO] Finished at: Wed Mar 14 10:35:20 IST 2012
[INFO] Final Memory: 7M/490M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project wso2appserver-samples-xkms: Could not resolve dependencies
for project org.wso2.appserver:wso2appserver-samples-xkms:jar:4.5.0-SNAPSHOT: Failed to collect dependencies for [org.wso2.xkms:xkms:jar:2.2 (compile)]: Failed to read artifact descriptor for org.apache.ws.security:wss4j:jar:1.5.2:
Could not transfer artifact org.apache.ws.security:wss4j:pom:1.5.2 from/to ws-zones-repository (http://ws.zones.apache.org/repository2): Error transferring file: Connection timed out -> [Help 1]
mvn dependency:tree --debug
outputs the tree before failing in my case.
One way to find this out, is to install the m2eclipse Maven plugin for Eclipse. (If you have and are using Eclipse, that is.) The name is unrelated to the version; it works happily with at least Maven 2.2.1 and 3.
http://www.eclipse.org/m2e/
Then, open your root pom in Eclipse, and click on the Dependency Hierarchy tab. On the right-hand side will be all the dependencies the project will download, and on the left is what dependencies ask for what. If a dependency says (managed from X), it means another dependency wants a different version of this dependency This isn't flawless, however. I still had too look at some of the other poms to find the dependency I was looking for. But it should make life easier, and at least point you in the right direction.

Resources