日食之外的maven java构建错误

时间:2015-07-09 14:46:06

标签: java eclipse maven pom.xml

我通常在eclipse中构建/生成java类文件。但是,现在我需要让项目在没有eclipse的机器上工作,所以我使用maven直接从命令行构建它。然后我得到了以下错误,我在这里错过了什么吗?谢谢!

Edamame$ mvn java:compile
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (13 KB at 23.9 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 KB at 36.1 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.023 s
[INFO] Finished at: 2015-07-09T07:23:05-07:00
[INFO] Final Memory: 9M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'java' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/Edamame/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

这是pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>edamame.hadoop</groupId>
    <artifactId>myProject</artifactId>
    <version>1.1</version>
    <packaging>pom</packaging>

    <name>EdamameProject</name>
    <url>http://myEdamame.com</url>

    <properties>
        <jdkLevel>1.7</jdkLevel>
        <requiredMavenVersion>[2.1,)</requiredMavenVersion>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.outputEncoding>UTF-8</project.build.outputEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.1</version>
                <configuration>
                    <source>${jdkLevel}</source>
                    <target>${jdkLevel}</target>
                    <showDeprecation>true</showDeprecation>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
         :
    </repositories>

    <dependencies>
        :
    </dependencies>
</project>

此外,这是&#34; mvn compile&#34;的输出,它成功了,只是没有创建目标/类文件夹及其类。

Edamame$ mvn compile
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building myProject 1.1
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.073 s
[INFO] Finished at: 2015-07-09T08:26:12-07:00
[INFO] Final Memory: 6M/245M
[INFO] ------------------------------------------------------------------------

2 个答案:

答案 0 :(得分:2)

首先,您需要将pom.xml中的location /upload { auth_request /auth; ... } location = /auth { internal; proxy_pass http://auth_service.localhost; proxy_pass_request_body off; proxy_set_header Content-Length ""; proxy_set_header X-Original-URI $request_uri; } 值更改为&#34; pom&#34;以外的值。让Maven运行编译插件。试试&#34; jar&#34;。

然后,如果您只想编译源代码,请使用

<packaging>

如果您想要打包的JAR,请致电

mvn compile

有关详细信息,请参阅Maven Build LifecycleMaven POM Reference

答案 1 :(得分:0)

你应该去:mvn编译(甚至mvn安装或类似的东西来测试它并制作一切)。