Maven Build : was cached in the local repository - maven

I am trying to build the multi module maven project but getting the error as below.
Unresolveable build extension: Plugin com.day.jcr.vault:content-package-maven-plugin:0.0.24 or one of its dependencies could not be resolved: Failure to find com.day.jcr.vault:content-package-maven-plugin:jar:0.0.24 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 2]
Unknown packaging: content-package # com.prj.prj.aem:aem-parent.ui.apps:[unknown-version], C:\latest\prj\ui.apps\pom.xml, line 34, column 16
I have the jar file content-package-maven-plugin-0.0.24.jar at C:\Users\user.m2\repository\com\day\jcr\vault\content-package-maven-plugin\0.0.24 location

You can do this.
mvn clean package -DskipTests -U -e
Notice that -U means to reload the jars from maven, that ignore the cache jars in your local file system.

Do you have the Adobe profile in your settings?
https://docs.adobe.com/docs/en/aem/6-2/develop/dev-tools/vlt-mavenplugin.html
(section "Obtaining the Content Package Maven Plugin")
I had the same issue as you, and resolved it by setting the activeByDefault to true in .m2/settings.xml

I faced a similar issue while using IntelliJ IDEA. Problem was that Idea has set a different maven home as I need to.
When you have this problem also with Idea, check your Settings -> Maven -> Maven home directory setting, if it is set as you need to.

Related

maven dependency error when i start to install mvn -nsu

Failed to execute goal on project netconf-exercise-impl: Could not resolve dependencies for project org.sdnhub.odl.tutorial.netconf-exercise:netconf-exercise-impl:bundle:1.0.0-SNAPSHOT: The following artifacts could not be resolved: openexi:nagasena:jar:0000.0002.0053.0, openexi:nagasena-rta:jar:0000.0002.0053.0: Failure to find openexi:nagasena:jar:0000.0002.0053.0 in http://nexus.opendaylight.org/content/repositories/opendaylight.release/ was cached in the local repository, resolution will not be reattempted until the update interval of opendaylight-release has elapsed or updates are forced -> [Help 1]
Yeap, had the exact same error, but copying the settings.xml from the official ODL wiki did it for me.
Just used this command from the wiki's instructions:
wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml
Same issue here. I am actively searching for an alternative jar location for nagasena and nagasena-rta so we can just update the repository list.
According to the OpenDaylight Wiki. You need to
Edit your ~/.m2/settings.xml
OpenDaylight maintains its own repositories outside of Maven Central, which means maven cannot resolve OpenDaylight artifacts by default. Since OpenDaylight is organized as multiple inter-dependent projects, building a particular project usually means pulling in some artifacts. In order to make this work, your maven installation needs to know the location of OpenDaylight repositories and has to taught to use them.
This is achieved by making sure ~/.m2/settings.xml looks something like the copy kept in odlparent. You can do that quickly with the following command"
cp -n ~/.m2/settings.xml{,.orig} ; \
wget -q -O - https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml > ~/.m2/settings.xml
after this you can then re-run mvn -nsu
“mvn clean install -nsu”
As pointed out by ShamanPrime and user2719303, you must configure your env with a custom ~/.m2/settings.xml file.
Full instructions are here: https://wiki.opendaylight.org/view/GettingStarted:Development_Environment_Setup

Jenkins maven projects ignore "Goals and options" specified in project "Build" section

The versions of my system are the following:
Jenkins ver. 1.633
Ubuntu version 14.04.2 LTS
Maven version 3.0.5
I have configured the Maven settings under "Manage Jenkins"-->"Configure system".
When I create an "Invoke top-level Maven targets" step in the "Pre Steps" section everything works as expected. In the "Goals" line I can specify "-X", "clean install", etc. and maven picks this Goals up by printing for example :
[DEBUG] Reading global settings from .../settings.xml
[DEBUG] Reading user settings from .../settings.xml
[DEBUG] Using local repository at .../repository
When I set the same goals (for example -X) in the "Goals and options" input field of the "Build section" I get only the following Jenkins console output:
Parsing POMs ERROR: Failed to parse POMs
org.apache.maven.project.ProjectBuildingException: Some problems were
encountered while processing the POMs: [FATAL] Non-resolvable parent
POM: Failure to find nl.icscards:ics-build-parent:pom:1.1.8 in
http://repo.maven.apache.org/maven2 was cached in the local
repository, resolution will not be reattempted until the update
interval of central has elapsed or updates are forced and
'parent.relativePath' points at wrong local POM # line 6, column 10
at
org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:364)
at hudson.maven.MavenEmbedder.buildProjects(MavenEmbedder.java:361)
at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:331)
at
hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1301)
at
hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1098)
at hudson.FilePath.act(FilePath.java:991) at
hudson.FilePath.act(FilePath.java:969) at
hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.parsePoms(MavenModuleSetBuild.java:960)
at
hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:679)
at
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
at hudson.model.Run.execute(Run.java:1741) at
hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531) at
hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:408) Finished: FAILURE
What I expect by specifying "-X" is to get some debugging information the same way as I do when invoking "Invoke top-level Maven targets" as a pre build step like I've shown above.
Please also note that everything works as expected as well if I create a "Freestyle project" instead of a "Maven Project" and execute there a shell statement of the form
cd <job_workspace>
mvn -X clean install
Also in this case I can see the expected output.
Any suggestions of what could be wrong in my "Maven project" jenkins configuration?
Thanks in advance for any replies.
Turns out that the problem was that maven could not find the parent pom which is an external dependency to the project.
The strange thing is that a Maven Jenkins project tries to get these dependencies even before maven can print debug information like which settings file it uses on the jenkins console. Therefore it fails, but it is difficult to guess what the issue is. I thought that it couldn't pick up the right repository path or the right settings.xml file.
In my case the issue was that in the parent pom dependency in the repository I have a file
parent.pom.lastUpdated
which contains a line:
http\://<private-VPN-host>/repo/repo-central/.lastUpdated=1439803113007
From the jenkins server I don't have access to the private VPN host and therefore it fails. Removing that file or the above line solves the problem.
The dependency is than correctly picked up and the maven project builds correctly.

Building Valkyrie RCP

I'm trying to build Valkyrie RCP from the 1.2 release. According to their instructions, it should be easy: "Just clone the repository, and then use a mvn install command."
However, when I try the command, I get the following error:
[ERROR] Failed to execute goal on project valkyrie-rcp-core: Could not
resolve dependencies for project dk.navicon:valkyrie-rcp-core:jar:1.2:
Failure to find com.l2fprod:l2fprod-common-all:jar:7.3 in
http://repo.maven.apache.org/maven2 was cached in the local
repository, resolution will not be reattempted until the update
interval of central has elapsed or updates are forced -> [Help 1]
I can see that l2fprod-common-all-7.3.jar is included in the dependencies folder but Maven seems to be unaware of that. How should I resolve this problem?
Actually, it's now possible to build it using Gradle, which doesn't have the dependency issues . Also, there's a dependencies folder with batch scripts to install the missing dependencies if you still wish to use Maven.
As of 2.0 Valkyrie RCP will use Gradle.
The problem is that the given version of that dependency does not exist in Maven Central only older versions.
They would probably suggest you do a mvn install first on the file in the dependencies folder, then.
Try go down in deps and do a
mvn install -DgroupId=com.l2fprod -DartifactId=l2fprod-common-all -Dversion=7.3 -Dpackaging=jar -Dfile=l2fprod-common-all-7.3.jar
That would get you past that point locally.
After that re-execute your project build with a -Uoption.
Long term is to find the artifact and include it in a repository that is searchable from your maven settings or project profile.

Jenkins could not resolve dependencies

I have a problem with jenkins version 1.500. i am trying to build a project with a dependency to another project of mine.
The error is:
[ERROR] Failed to execute goal on project projectname: Could not resolve dependencies for project projectname:jar:1.0.0: Failure to find reference-project:jar:1.0.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
If I build this project via console and Maven, the whole projects build succeed.
I checked the dependency jar file in the repository, it is there at the right place.
Does Maven have a own repository or did I miss something?
But under the Jenkins system settings, I chose "Default(~/.m2/repository)" and I did not check the checkbox "use own repository" at the project settings. Any ideas?
UPDATE
I created a extra job for the dependency in jenkins and called the Maven goal install and then everything works fine. Before this step I installed the dependency via Console and mvn install.
Why is there a difference? (i tried the given solution with delete and reinstall, but this did not help)
Simple solution delete the folder from the ~/.m2/repository which represents the artifact you've written about. ~/.m2/repository/${groupId}/... and rebuild. That happens sometimes if you have some problems during download of the artifact etc.
I too have similar problem and tried deleting the folder in ~/.m2/repository/
still its now downloading dependencies from remote repository location to local

Update interval of Maven Central Repo

Having zero experience with Maven, I am running a mvn clean install on a project and this is the error I get:
[ERROR] Failed to execute goal on project dnasequencing.CompaNY.com: Could not resolve dependencies for project com.CompaNY.dnasequencing:dnasequencing.
CompaNY.com:war:1.0-SNAPSHOT: The following artifacts could not be resolved: dsr-kepler:dsr-kepler:jar:0.0.1-SNAPSHOT, dsr-parser:dsr-parser:jar:0.0.1-
SNAPSHOT: Failure to find dsr-kepler:dsr-kepler:jar:0.0.1-SNAPSHOT in http://repo1.maven.org/maven2/ was cached in the local repository, resolution
will not be reattempted until the update interval of Maven_Central_Repo has elapsed or updates are forced -> [Help 1]
Based on these error messages, what is an startingpoint I should take a look for finding what is going wrong?
You can force Maven to update snapshots with the -U flag.
As far as what is going wrong, you can always check out the actual Maven website with your browser and see if the dependency actually exists.
http://search.maven.org/
If the dependency is not hosted in Maven central, then it seems it is a local dependency that you have to install in your local cache (run mvn clean install from that project).

Resources