Maven deploy fails on Maven parent project - maven

I have a maven project with the following hierarchy as created with NetBeans:
root/
Parent/
pom.xml
Project 1/
pom.xml
Project 2/
pom.xml
....
Project x/
pom.xml
When I try the release:perform it fails when attempting to deploy:
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project (C:\checkout\pom.xml) has 1 error
[ERROR] Non-readable POM C:\checkout\pom.xml: C:\checkout\pom.xml (The system cannot find the file specified)
It looks like the plugin expects the pom to be on the root folder. I was unable to find a customization point on the plug-in to specify the pom.xml location.
Is this not possible, or did I organize the project wrong?

Searching on the net I found this post which pointed me to a question with the answer here.

It looks like you are trying to run mvn release:perform from your checkout root directory, while you should cd to Parent instead.
I assume that your project is indeed stored under Subversion or some other Maven-supported version control tool and that you checked it out in your C:\checkout directory.

Related

How to solve Exception: basedir doesnot exist

I am trying to dockerize a springboot project using maven.
So i ran a command
mvn package -Pdocker '-Dmaven.test.skip=true' docker:build
Below is the image of how the file structure of the project is
image and below is the error
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (default-cli) on project poplar: Exception caught: basedir C:...\server\target does not exist -> [Help 1]
I am trying to find out how i can solve the problem because from the project structure there is no target folder for the root project poplar though the subprojects have target folders in them.
An easy fix is to create the target directory in the base project directory. For more details about the issue see here. The error is reproduced here
I would suggest you change the project structure and add a maven sub-module responsible for building the docker container.

Maven default evaluation of the pom xml file

We do not have project design in parent and module way.We have project A and project B . Project A has dependency of project B . we passing the version of the dependency jar by command prompt in eclipse, Its compiling and install properly. but its pom shows always error.and error is like
Missing artifact
com.testdependency:testdependency:jar:org.apache.maven.model.Build#5ae16e48
Passed the build parameter by command line like -Dbuild. Is there any way resolve this ?
pom.xml would need the dependencies present in your local .m2 repository. If you don't install the dependencies to your local repository, pom.xml can't find them. So, run a build on your dependency project with goals selected as clean install, which should insall the artifact to your local repository. Then in your eclipse, right click on the main project and execute Maven -> Update Project. This should resolve your issue.
Refer to this link for the details on the repositories

Maven artifact of same project failed

I have a Maven project with following structure
/app
/- pom.xml
/- app-api
/- pom.xml
/- app-impl
/- pom.xml
There are some external dependencies, but when I tried to build the project Maven failed while trying to retrieve app-api from external source with error
[ERROR] Failed to execute goal on project app-impl: Could not resolve
dependencies for project com.examp:app-impl:jar:0.0.0.1: Could not
transfer artifact com.example:app-api:jar:0.0.0.1 from/to
nexus-snapshot (http://example.com/repository/snapshot): Failed to
transfer file:
http://example.com/repository/snapshot/com/example/app-api/0.0.0.1/app-api-0.0.0.1.jar.
Return code is: 400 , ReasonPhrase:Bad Request. -> [Help 1]
The snapshot repository policies forbid 4 digit version. But I cannot understand why Maven does not associate that dependency locally.
If the desired artifact is in your local repository (.m2/repository), Maven should find it there (without looking in remote repositories).
Otherwise, have a look at your settings.xml and see whether you misconfigured your repositories.

Can't generate the new Maven project

I'm following the tutorial from Red Hat and I'm running a query in maven:
mvn archetype:generate
-DarchetypeGroupId=io.fabric8.archetypes
-DarchetypeArtifactId=karaf-camel-cbr-archetype
-DarchetypeVersion=1.2.0.redhat-630187
-DgroupId=tutorial
-DartifactId=tx-jms-router
-Dversion=1.0-SNAPSHOT
-Dfabric8-profile=tx-jms-router-profile
But I see an error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3
.0.1:generate (default-cli) on project standalone-pom: The desired archetype doe
s not exist (io.fabric8.archetypes:karaf-camel-cbr-archetype:1.2.0.redhat-630187
) -> [Help 1]
I tried to create a maven project using the Jboss Developer Studio, but the result was the same
If you look here
...you'll notice the artifact is not in central maven repo.
So the problem is that you need to tell Maven to look also in non-default places.
Therefore, you need to edit your settings.xml and add an extra repository (in the above link, you are pointed towards the right repository).
https://maven.repository.redhat.com/ga/
Edit: Related to adding repositories in settings.xml (related to your comment below). There are two things wrong with your listing:
You're missing an activeProfiles tag as seen here (you only have activeProfile)
The fact that you were missing the activeProfiles tag and you DID NOT got a Maven error leads me to believe that you modified the wrong settings.xml. Did you tried to modify the one from the .m2 folder?
try this
-DarchetypeRepository=http://repo.open.iona.com/maven2

Maven release no POM in this directory

I am trying to use the maven-release-plugin 2.3.2 on a multi module POM. (Maven 3.0.4)
release:prepare works fine but release:perform fails with this error
[INFO] org.apache.maven.lifecycle.MissingProjectException: The goal you specified
requires a project to execute but there is no POM in this directory (...<workspace>/target
/checkout). Please verify you invoked Maven from the correct directory.
Now the parent POM lies inside this <workspace>/ but in the <workspace>/target/checkout there is no POM as the target directory was created by the plugin. I am assuming there should be a copy of the pom.xml here which should be created by the plugin and that is why the error.
What I am doing wrong ? Directory and POM structure attached. Module 1 and 2 both have respective pom.xmls in root.
I have looked at maven release plugin, git, and the pom's not at the top , maven generating pom file , Maven 3.0's "mvn release:perform" doesn't like a pom.xml that isn't in its git repo's root directory . They don't help as my pom already lies in the repo's (SVN) root directory and this directory where the plugin is looking for the POM is only temporary, so I cannot/should not hard-code it.
Fixed it.. wrong path in the tag in the parent POM. Comment from khmarbaise got me thinking that the path in SVN=Jenkins workspace=path in is the only way it can work and thats how it did.
Make sure you have not committed target folder in the project structure, due to which its checking out in that folder, and hence not able to find the pom file.
I faced the similar issue.:)

Resources