简体   繁体   中英

maven build error

I am very much new to maven. I downloaded the maven 2.0.11 version and installed it on my 32bit redhat linux along with JDK 1.4

After installation I have configured the proxy settings. When I try to run command mvn install downlaod of some repository(org) is successful but then it fails with build error as below :

[INFO] ------------------------------------------------------------------------   
[ERROR] BUILD ERROR   
[INFO] ------------------------------------------------------------------------   
[INFO] Cannot execute mojo: resources. It requires a project with an existing pom.xml, but the build is not using one.   
[INFO] ------------------------------------------------------------------------   
[INFO] For more information, run Maven with the -e switch   
[INFO] ------------------------------------------------------------------------   
[INFO] Total time: 16 second

What does this error mean ? and what configuration I am missing ?
How can I downlaod the complete repository ?

Thanks,

This error usually means there is no pom.xml in the current directory where you're trying to build.

The ant build.xml has references to a few pom files:

<xmlproperty file="${IMPERIUS_SVN_MODULES}/pom.xml"/>
<property name="POM_XML_FILE" value="${basedir}/pom.xml"/>
<property name="POM_XML_URL" value="${IMPERIUS_SVN_TRUNK_REPOSITORY}/pom.xml?view=co"/>
<get src="${POM_XML_URL}" dest="${POM_XML_FILE}"/>

Can you check that these are being pulled down when you run ant ? If not, try downloading the pom manually from here and save it in the same directory as build.xml . Then try running ant again.

Your Maven installation seems correct. However, to be run, the Maven command must be run in the directory where the pom.xml file is located. It seems that you don't have any pom.xml in the current directory.

The pom.xml file describes your project, and it is the basis of Maven 2. Read the official documentation to get more information about this file.

Note that Maven also provides the Archetype plugin , which can be used to create a brand new project of a specific type (Java project, Web application, Hibernate, Spring, and so on). The archetype will create the default structure and some files (including the pom.xml ) for this type of project. This plugin is the only case of Maven usage without a pom.xml file.

I was having this issue today as well. Under the configurations for Maven Build I had changed the Base directory: from eg

C:/local/project/MyProject

, which was set by using the Browse File System... to

${workspace_loc:/MyProject}

set by the Browse Workspace... and was able to build the project.

it seems that you are not in the same directory as in the pom.xml is located. Maven project looks for pom.xml at first to build the project . Please make sure you are building the project from the directory where the pom.xml is and also be careful that pom.xml should be correct hierarchy wise else it will not load some basic structure of project or will create one in internal folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM