Maven- Error building pom - java

While trying mvn clean install I got the following error:
[INFO] Error building POM (may not be this project's POM).
Project ID: org.codehaus.plexus:plexus-components:pom:1.1.15
Reason: Cannot find parent: org.codehaus.plexus:plexus for project: org.codehaus.plexus:plexus-components:pom:1.1.15 for project org.codehaus.plexus:plexus-components:pom:1.1.15
The same works when I user mvn clean install as root user. What may be the possible reason?

Follow these steps:-
Update maven to version 3.
Deleted the .m2/org/codehaus folder.
Build the project.
Issue fixed!

Related

maven project run successfully but cann't build

I have a Maven projects and i want to build a project with Maven to create excutable JAR
I can run the project successfully but
when i run Maven build... in eclipse with the command clean package i get(this is just a sample of the log but the rest of the log just repeat the same type of errors)
[INFO] Compiling 6 source files to C:\StrockMarketAnalyzer\USB\master\integ\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] C:\xxx\xxx\xxx\xxx-parent\xxx- integ\src\main\java\com/xxx/xxx/xxx\communicationInterface\IbfAdministrator.java:[22,48] error: package com.xxx/xxx/xxx.businessObject does not exist
[ERROR] C:\xxx\xxx\xxx-parent\xxx-integ\src\main\java\com\xxx\xxx\xxx\xxx\communicationInterface\IbfAdministrator.java:[23,48] error: package com.xxx.xxx.xxx.xxx.businessObject does not exist
and this is the pom.xml of the project i want to build.
<parent>
<groupId>com.xxx.xxx.xxx.xxx</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>integ</artifactId>
I am using packages from other projects that i created when i look to the JAR's in Maven dependency i can find the other projects with a folder icone and Inside them i can find there dependency but not there packages.
I hope there're enough information for you to know what's the problem
Try to run the parent project (with the same conf.)not the project it self.
Right klik project --> update project, wait for the Workbench to build then build using maven. This is a stopgap and not a permanent solution which i myself have not found yet.
You probably "run" the previous version of a program, without building it new.
You must write the dependencies and (their) repositories you use in pom.xml, the parent tag is strange to me.
Also, if you have dependency to another project you r working on clean and build it first.

Jenkins: Maven project with modules that won't be build: no pom.xml found

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.

Why is m2e not finding some of my snapshot dependencies from nexus?

In eclipse when I build I get the following warnings:
2/18/14, 4:30:35 PM MST: [INFO] Using org.maven.ide.eclipse.wtp.WarLifecycleMapping lifecycle mapping for MavenProject: com.foo:bar:14.4.19-SNAPSHOT # C:\dev\code\apps\iv\pom.xml.
2/18/14, 4:30:35 PM MST: [WARN] The POM for com.foo.libraries:s2j:jar:1.0.3-SNAPSHOT is missing, no dependency information available
2/18/14, 4:30:35 PM MST: [WARN] The POM for com.foo.libraries:caching:jar:1.0.1-SNAPSHOT is missing, no dependency information available
2/18/14, 4:30:35 PM MST: [WARN] The POM for com.foo.libraries:email:jar:1.0.1-SNAPSHOT is missing, no dependency information available
...
And so on. The build does not complete and I am unable to get anything more in my target directory than the m2e-wtp/web-resources folder.
When I build from the command line, there are no issues, these artifacts are found just fine. They certainly are in my local repository, why does this happen?
Some further details from experiments:
Deleting my local repository and rebuilding in eclipse downloaded some of the artifacts, but resulted in more artifacts to not be found (originally I had 5 missing artifacts, now I have 7). Those that were not found were not downloaded from Nexus.
After having deleted the repository in the experiment above, I then built from the command line and those artifacts that had been listed as missing were downloaded and the build was successful. However, going back to eclipse results in the same errors (despite now having them in my local repository).
Inside eclipse when I "Run As" > "Maven Install" The missing artifacts are downloaded and are found. If I do an eclipse "Build Project" after this I still get the same issue.
Other projects within eclipse are experiencing the same issues on the same artifacts.
Something similar happened to me once. I've checkout com.foo:bar as well as com.foo.libraries:s2j, but I haven't configure the library as maven project in eclipse. So the maven install worked just fine (only the pom file was used), but the eclipse build failed.
So check that all the projects are configured as maven ones and try Maven > Update project and check Force update of snapshots and Clean projects.
I found the solution.
Apparently when I did a mass close of workspace resolved projects some of them were left in a bad state. It looks like eclipse was trying to find the jar as a workspace resolved project, but the projects were closed and caused the result that they didn't exists (instead of looking at my local repository).
Once I opened (and then closed) the respective project for each of the missing dependencies they were then found in my local repository.

Creating a Maven Artifact from (Eclipse) Project, and Generating New Project from it

I have an Maven (eclipse) Project, which i want to convert to an Maven Artifact - so that others can generate new Project from it.
To create Artifact i did:
cd to my proj dir where pom.xml exists
mvn install
After this i can see that
.m2\repository has my project added.
But <user_home>\.m2\archetype-catalog.xml - did not have the archetype added.
So, i added manually as follows:
<archetype>
<groupId>com.whatever</groupId>
<artifactId>myapp</artifactId>
<version>1.0.0-BUILD-SNAPSHOT</version>
<repository></repository>
</archetype>
Now, i am not sure what to give in tag, as this is a local repository.
But, i am unable to generate a new project using:
mvn archetype:generate -DarchetypeCatalog=local
It asks me to choose the archetype, but after that i get error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2
.2:generate (default-cli) on project standalone-pom: The desired archetype does
not exist (com.whatever:myapp:1.0.0-BUILD-SNAPSHOT) -> [Help 1]
What step am i missing?
You need to run the archetype plugin from within your original project to generate an archetype descriptor.
Here is an example of how to do this.
The complete steps are listed here:
http://hello-its-crazy.blogspot.in/2012/08/steps-to-create-maven-archetype-from.html

Why does maven site:site fail in a multi-module project?

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

Categories