Linux Maven 构建错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3797279/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
maven build error
提问by hits_lucky
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
我对 maven 非常陌生。我下载了 maven 2.0.11 版本并将它与 JDK 1.4 一起安装在我的 32 位 redhat linux 上
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 :
安装后我已经配置了代理设置。当我尝试运行mvn install
某些存储库(org)的命令downlaod 时成功,但随后失败并出现构建错误,如下所示:
[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,
谢谢,
采纳答案by dogbane
This error usually means there is no pom.xml
in the current directory where
you're trying to build.
此错误通常意味着pom.xml
您尝试构建的当前目录中没有。
The ant build.xml
has references to a few pom files:
蚂蚁build.xml
引用了几个 pom 文件:
<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 hereand save it in the same directory as build.xml
. Then try running ant
again.
你能在跑步时检查这些是否被拉下ant
吗?如果没有,请尝试从此处手动下载 pom并将其保存在与build.xml
. 然后ant
再次尝试运行。
回答by Romain Linsolas
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.
您的 Maven 安装似乎正确。但是,要运行,必须在文件所在的目录中运行 Maven 命令pom.xml
。您pom.xml
当前目录中似乎没有任何内容。
The pom.xml
file describes your project, and it is the basis of Maven 2. Read the official documentationto get more information about this file.
该pom.xml
文件描述了您的项目,它是 Maven 2 的基础。阅读官方文档以获取有关此文件的更多信息。
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.
请注意,Maven 还提供了Archetype 插件,可用于创建特定类型(Java 项目、Web 应用程序、Hibernate、Spring 等)的全新项目。原型将为pom.xml
此类项目创建默认结构和一些文件(包括)。这个插件是唯一一个没有pom.xml
文件的 Maven 使用情况。
回答by Elijah
I was having this issue today as well. Under the configurations for Maven Build I had changed the Base directory: from e.g.
我今天也遇到了这个问题。在 Maven Build 的配置下,我更改了 Base 目录:从例如
C:/local/project/MyProject
C:/本地/项目/我的项目
, which was set by using the Browse File System...to
,这是通过设置浏览文件系统...到
${workspace_loc:/MyProject}
${workspace_loc:/MyProject}
set by the Browse Workspace...and was able to build the project.
由Browse Workspace... 设置并能够构建项目。
回答by Sagar Kharab
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.
看来你和 pom.xml 所在的目录不在同一个目录下。Maven 项目pom.xml
首先寻找构建项目。请确保您正在从目录构建项目,pom.xml
并注意 pom.xml 应该是正确的层次结构,否则它不会加载项目的一些基本结构或将在内部文件夹中创建一个。