Maven cannot get artifact from my local repository - maven

Trying to get the follwing JAR from my local/internal repository:
httpclient-4.3.1.jar
Maven fails with Error:
ArtifactDescriptionException: Failed to read artifact descriptor for org.apache.....
It works fine with every single other jar but it fails on this apache one. No idea why. Tried clearing .m2\repository, upgrading Maven, eclipse, re-uploading, nothing worked.

Try mvn -U clean install command.
It checks for updates and releases and snapshots on remote repository."-U" forces to check the updates.

Related

I have a problem with Maven 3.8.4 that not allowed to authorize our private repo on Apache Archiva

I have installed Maven 3.8.4 with homebrew on Macbook M1 CPU recently and I have ~/.m2/settings.xml properly containing the Apache Archiva user name and password.
when I executed mvn help:effective-settings -DshowPasswords=true command I can see the correct xml content. But when I run mvn clean package I get something like that
Failed to read artifact descriptor for company.webshop:webshop-common:jar:21.11.12:
Could not transfer artifact company.webshop:webshop-common:pom:21.11.12
from/to company (https://repo.company.com/repository/internal/):
authorization failed for https://repo.company.com/repository/internal/company/webshop/webshop-
common/21.11.12/webshop-common-21.11.12.pom,
status: 403 Forbidden -> [Help 1]
when I try to access https://repo.company.com/repository/internal/ address from my browser I can login and see the artifacts properly as well. More than that other team members don't live any problem.
I also removed maven and reinstalled but nothing changed.
any idea?
I noticed that after removing the folders (under the .m2 folder) related to our private repo, and re-run the maven after a fresh instalment it's working properly.
Maven was not downloading the artifacts I guess, since there is a folder of that version number and only showing the content of old files which says something like "not authorized to the repo." and was miss leading

Q: The proxy repo in Nexus cannot download the special SNAPSHOT structure from remote repo

there is a special SNAPSHOT structure in the remote repository as following.
i create a proxy repository in Nexus pointed to this remote repository. but an error happened while running mvn packaging. the error message is as following:
[ERROR] Failed to execute goal on project dispatch-admin: Could not resolve dependencies for project com.yueyue:dispatch-admin:jar:2.0.0-SNAPSHOT: Could not find artifact com.yueyue:order-search-interface:jar:1.2.1.SNAPSHOT in aliyun_release2 (http://192.168.200.224:8081/repository/aliyun_release2/)
and there is a warning while pulling the package as following
but it is OK while using remote repository for mvn packaging. and the message is shown as following while pulling the package.
what should i check first for this problem? many thanks in advance!

Maven Build gets Failed saying Could not assemble p2 repository: Mirroring failed: No repository found at

I have a maven build for building an eclipse plugin which gets hung sporadically during the execution of
--- tycho-p2-repository-plugin:1.1.0:assemble-repository (default-assemble-repository) # com.sample.product ---
Otherwise the build will get failed saying the following error.
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-p2-repository-plugin:1.1.0:assemble-repository (default-assemble-repository) on project p2:Could not assemble p2 repository: Mirroring failed: No repository found at file:/C:/Users/obuli/.m2/repository/.
I am using the following maven goals and options
clean deploy -Dtycho.localArtifacts=ignore
I have searched for this issue and landed on this Bug , It says there was a bug in tycho 0.26.0 But I am currently using Tycho version 1.1.0
Since the issue is very sporadic I could not able to identify the root cause. Please let me what I am missing here.
I intermittently had this problem as well. After running mvn clean and mvn deploy separately once, mvn clean deploy started working as well.
Now I don't seem to be able to recreate the original issue, even using git clean -xfd and deleting all snapshots from the local and remote repository.
I can only guess that there were some leftover files from earlier builds which were not cleaned by mvn clean deploy but by mvn clean, and these leftover files must have broken the build.

Installing current version of DWR via Maven

I checked out current SVN Snapshot of DWR (3.0.0-rc3-SNAPSHOT) and I am unable to mvn install it - the pom.xml seem to be configured not for such command. What is the correct way of installing DWR into maven repo?
I also tried copying files from https://oss.sonatype.org/content/repositories/snapshots/org/directwebremoting/dwr/3.0.0-rc3-SNAPSHOT/ and mvn installing them as well. This way obviously does not work either. How can it be installed from here? I don't want to link to the snapshot directory directory from my pom.xml as I don't want to get unexpected results when new snapshot is introduced.
I'm not sure if I get you correctly, but you can always download the JAR and install it locally using Maven. Something like this:
mvn install:install-file -Dfile=dwr-3.0.0-rc3-20130514.180049-1.jar -DgroupId=org.directwebremoting -DartifactId=dwr -Dversion=3.0.0-rc3-SNAPSHOT -Dpackaging=jar
more on the Maven info here:
http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
EDIT:
I managed to install it from source as well by do SVN checkout:
svn co https://svn.directwebremoting.org/dwr/trunk/
My first attempt to build it failed because I was using Maven 2.x. Seems like DWR is using Maven enforcer plugin to enforce certain Maven version. I didn't check which version is really required but by updating my Maven to Maven3 I managed to install it.

maven release perform failed

Today while doing the release of our project, the release:perform command failed in between as our nexus was having intermittent issues. The release command only able to upload one pom file to nexus.
Now, the nexus issue is resolved and I am trying to do the release, it fails as the pom file already exists and its not the snapshot version and we don't have access to nexus so that I can delete that file and start over again.
Is there any way I can pass an argument so that release:perform should continue if the file is already there and ignore this but continue with uploading the rest.
I have looked for options of such type but didn't find anything.
My last resource would be to start the release again, which will bump the version number, but would like to understand if there is any other approach where in I don't need to bump the version.
I am using maven 2.2.1
Here's how I have handled this in the past. The release:perform command does a checkout of the tag from your SCM provider (e.g. SVN). This is done in the target/checkout directory of that project - whatever is there should be an exact copy of the released tag, so it will have the right version number in the pom files etc.
If you move to that directory (target/checkout in the directory where you started the release), you can simply do a mvn deploy there and it should compile and package that version, and then upload it to your Nexus instance.
If you don't have the target/checkout directory, you can check out the Tag created as part of the release:prepare phase from your SCM system to a fresh directory and run mvn deploy there.
Since the tag in your SCM has already been created, the only thing that's left is really compiling, packaging and deploying the release, which is exactly what mvn deploy should do.
If you have provided additional parameters (e.g. for activating profiles) for the build during the call to mvn release:perform, you will have to provide these as well when you run mvn deploy.
Using this approach, your version number will not have to change, it can stay the same, since you're just uploading what has already been tagged as part of mvn release:prepare.
My advice would be for you to request from the admins that the old artifact be removed. You can either re-deploy the code from the tag by checking it out and simply doing
mvn deploy
Or rolling back your release:
mvn release:rollback
And re-doing it as usual.
It is essential to remove the old artifact from the remote repository, if the sizes do not match. Release repositories do not allow the redeployment of artifacts, unless this has been explicitly switched on on the server side.
Furthermore, #nwinkler's answer is also quite good.

Resources