When I execute the mvn install inside the project sm-core of Shopizer, I am getting the below error:
[ERROR] Failed to execute goal on project sm-core:
Could not resolve dependencies for project
com.shopizer:sm-core:jar:2.0.3-SNAPSHOT: The following
artifacts could not be resolved: com.shopizer:sm-core-model:
jar:2.0.3-SNAPSHOT, com.shopizer:sm-core-modules:jar:2.0.3-SNAPSHOT:
Failure to find com.shopizer:sm-core-model:jar:2.0.3-SNAPSHOT
in http://maven.springframework.org/snapshot was
cached in the local repository, resolution will not be
reattempted until the update interval of
org.springframework.maven.snapshot has elapsed or updates
are forced -> [Help 1]
How can I solve it?
The Shopizer project is actually a multi-module Maven project. This means that it has a root pom.xml of packaging pom and declares several <modules>.
Those modules, which are Maven project themselves, are typically found as sub-folders under this root folder, which is the case here: there are 4 sub-folders, which are exactly the 4 Maven modules. To compile those sort of projects, you need to invoke Maven from the root project, in this case, shopizer.
You may ask why. In a multi-module Maven project, there is generally inter-dependencies: one module is dependent on another. In this case, the scm-core module that you're trying to build has dependencies on both sm-core-model and sm-core-modules, which are two modules of that project. So when you're building it, Maven will try to look in your local repository those artifacts. The problem is that it won't find them: they have never been built before. Maven won't also find them on a public repository because we're dealing with SNAPSHOT dependencies. The solution is to start the build on the top project: Maven will order correctly the reactor so that when it builds scm-core, both those dependencies will have been built.
Put simply: in a multi-module Maven project, you should practically always invoke Maven commands from the root POM.
To solve your problem, you can check-out the 2.0.3 branch (which is the latest branch) and invoke mvn clean install on the root POM. I did just that successfully.
Related
My project is structured with a Parent POM and lots of modules each having child POMs themselves. Currently I'm doing a maven build with my Parent POM which is building the entire project. How can I convert this to a delta build i.e. I want to build only the module which has changed files?
I'm unable to find any plugins suiting this need.
Another approach is writing a script to find the deltas and build individually.
Can someone please advise.
Thanks in advance.
Slightly unrelated but if you know which module you are working on you can use Maven reactor to build this module with related dependencies by running:
mvn install -pl :my-module -am
-pl, --projects
Build specified reactor projects instead of all projects
-am, --also-make
If project list is specified, also build projects required by the list
I have cloned the git repository from https://github.com/viatra/org.eclipse.viatra.examples
and imported the project incquery-demo-generic (located in /query/headless-maven) as a Maven Project in Eclipse. Unfortunately I get the following error when I open the project's pom.xml:
Furthermore everytime when I click on "Run As" -> "Maven install" or "Maven build..." I get the following error message in the console:
Failed to execute goal on project incquery-demo-generic: Could not resolve dependencies for project hu.bme.mit.incquery:incquery-demo-generic:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at org.eclipse.incquery:runtime:jar:0.8.0-SNAPSHOT: Failed to read artifact descriptor for org.eclipse.incquery:runtime:jar:0.8.0-SNAPSHOT: Failure to find org.eclipse.incquery:org.eclipse.incquery.parent:pom:0.8.0-SNAPSHOT in https://repo.eclipse.org/content/repositories/emf-incquery-snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of incquery-snapshot has elapsed or updates are forced -> [Help 1]
Blockquote
In the Maven Dependencies Folder I can find some, but not all necessary jar files.
I have tried "Project clean", "Maven update", "Maven build... (Goal: clean package)" and to delete the .m2 repository and to re-build the maven project, but nothing helps.
I also tried to download some dependencies as .jar files and add them to the build-path, but they contain nothing but pom.xml and properties-files themself, thus I keep getting "cannot be resolved to a type" errors in relevant parts of the Java src-code.
Can somebody successfully run this project in her/his eclipse?
I am not an expert on Maven Projects so please tell me what to do in "layman words".
Thanks & kind regards,
MCRaven
The projects in the VIATRA examples repository (I notice it as one of the committers of the VIATRA project) are somewhat unusual: they are Eclipse plug-in projects that have Maven build informations added via Maven Tycho.
One more thing here: the 0.8.0 version of EMF-IncQuery bundles was released in 2014, thus it makes sense that the corresponding snapshot versions are removed. This means to me that this example was not updated for a long time. This is somewhat by design - some examples are not updated for each released version, but they are not are still available for references. If you are explicitly interested in this example, please contact us on VIATRA project forums or Bugzilla and we will provide example-specific support there.
Inside Eclipse we usually not rely on Maven (and our experience is that Tycho-based projects often does not work with M2E correctly). You could try to update Maven dependencies for the org.eclipse.incquery projects to 0.8.0, but I am still unsure whether it will work or not.
On the other hand, I'd rather suggest to install the old EMF-IncQuery version into your Eclipse instance and then simply rely on the Java Development Tools and the Plugin Development Environment to compile the project, and simply ignore any errors in the Maven descriptors for now.
I've got 3 maven projects.
Project A defines B and C as module in it's pom.xml
Now I want to use Jenkins.
I defined to checkout/build project A and I think I have to manually checkout/build B and C as well, right?
The project didn't find the pom.xml of the other projects.
I defined them with relative path.
It works fine on my local machine, but it crashes on Jenkins:
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM: Failure to find de.saenger:xyz:pom:1.0.0-SNAPSHOT
Now ... how to let the projects knowing each other?
Run mvn build on parent pom. It will build modules automatically.
You're running mvn build on module and mvn searches your local repository for parent pom to resolve dependencies but can't find the pom because you haven't built it yet.
I'm working on a multimodule maven project. Some time ago, the project was partitioned into subprojects:
"Common" JAR project
"User" WAR project, depending on Common
etc.
It's the same project as described here, in this question.
When I invoke mvn package at superproject level, command succeeds and resulting war can be deployed. But if I try to invoke mvn package at subproject level, command fails.
[ERROR] Failed to execute goal on project User: Could not resolve
dependencies for project xxx.xxx:User:war:0.0.1-SNAPSHOT: Failed
to collect dependencies for [xxx.xxx:Common:jar:0.0.1-SNAPSHOT (compile), ...
Apparently maven is trying to download my own project (Common) from remote repo...
Downloading: http://repository.jboss.org/maven2/xxx/xxx/Common/0.0.1-SNAPSHOT/maven-metadata.xml
Downloading: http://download.java.net/maven/glassfish/xxx/xxx/Common/0.0.1-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata xxx.xxx:Common:0.0.1-SNAPSHOT/maven-metadata.xml from/to jboss (http:/
/repository.jboss.org/maven2): Access denied to: http://repository.jboss.org/maven2/xxx/xxx/common/0.0.1-SNA
PSHOT/maven-metadata.xml
What could possibly be wrong in my config?
When you run mvn package from superproject, it creates the artifacts in the respective target folder, but does not install them in your local repository.
So, when you run mvn package on a subproject, which has a dependency on a sibling module, it looks for the dependency in your local repository, does not find it and thus attempts to download it from the various repositories configured.
Once you successfully run an mvn install from superproject, an mvn package on the subproject should work.
You have a (JBoss) repository entry either in your pom.xml or settings.xml.
To access this repository it is required to be authenticated. If you call the path with your browser, you get also "403 Forbidden". You have to add a public repository of Jboss. (http://repository.jboss.org/)
I have spent a lot of time to find out this sort of 'ERROR', thanks to Raghuram, I was stupid when trying to find the solution but there was actually no error, just because I did mvn install in a submodule which depends on dependencies of other modules, It should work fine when i run mvn install/package on parent scope.
I have a Maven-3 multi-module project:
/root
pom.xml
/bar
pom.xml
/foo
pom.xml
Module foo depends on module bar, and they both have the same parent: root. Everything works fine, until I decided to clean my local repository and run mvn site:site. Build fails with a message:
Failed to resolve artifact.
Missing:
1) com.XXX:bar:jar:1.0-SNAPSHOT
It is a known bug or I'm doing something wrong? I didn't configure maven-project-info-reports-plugin anyhow in any pom.xml yet.
If you do site:site, you are running the specific site goal and not the build cycle, thus the project will not build, and since you just cleaned the repository, the artifact will not be there anywhere to use.
See following links for more information about build lifecycles in maven:
http://www.sonatype.com/books/mvnref-book/reference/lifecycle.html
http://www.sonatype.com/books/mvnref-book/reference/lifecycle-sect-package-specific.html
Perhaps you should try goal site:stage on the root/master-pom.
I didn't try this with src/site in the childs, cause i only have a src/site in the master.
But this work fine for me with Maven 3.0 and a menu ref="reports" in roots site.xml and
putting maven-project-info-reports-plugin in the childs pom.xml