Maven 3警告:构建失败

时间:2017-03-27 19:09:58

标签: maven maven-3

我正在尝试使用来自https://github.com/petrabarus/HiveUDFs的HiveUDF。我下载了UDF,打开了一个Cygwin终端,将目录(cd)更改为包含pom.xml的文件夹,然后运行mvn。它给出了错误,我根据Maven 3 warnings about build.plugins.plugin.version中第一个答案中的说明编辑了pom.xml

我仍然遇到以下错误,尽管谷歌搜索,我仍然无法解决它们。

$ mvn -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for net.petrabarus.:HiveUDFs:jar:1.0-SN                          APSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 18,                           column 33
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.081 s
[INFO] Finished at: 2017-03-23T15:47:49-07:00
[INFO] Final Memory: 7M/180M
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the form                          at <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle                           phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile                          , process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, te                          st-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-inte                          gration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [He                          lp 1]
org.apache.maven.lifecycle.NoGoalSpecifiedException: No goals have been specified for this build. You must specify                           a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<                          plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, g                          enerate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, genera                          te-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-                          integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, p                          re-site, site, post-site, site-deploy.
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:94)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR]
[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/NoGoalSpecifiedException

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>net.petrabarus.</groupId>
        <artifactId>HiveUDFs</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>jar</packaging>

        <name>HiveUDFs</name>
        <url>http://maven.apache.org</url>

        <properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
        <build>
                <plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <configuration>
                                        <source>1.6</source>
                                        <target>1.6</target>
                                </configuration>
                        </plugin>
                </plugins>
        </build>
        <repositories>
                <repository>
                        <id>Sonatype-public</id>
                        <name>SnakeYAML repository</name>
                        <url>http://oss.sonatype.org/content/groups/public/</url>
                </repository>
        </repositories>
        <dependencies>
                <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>3.8.1</version>
                        <scope>test</scope>
                </dependency>
                <dependency>
                        <groupId>org.apache.hive</groupId>
                        <artifactId>hive-exec</artifactId>
                        <version>0.9.0</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.apache.hadoop</groupId>
                        <artifactId>hadoop-core</artifactId>
                        <version>1.1.1</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>javax.jdo</groupId>
                        <artifactId>jdo2-api</artifactId>
                        <version>2.3-20090302111651</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>commons-lang</groupId>
                        <artifactId>commons-lang</artifactId>
                        <version>3.3.9</version>
                </dependency>
        </dependencies>
</project>

2 个答案:

答案 0 :(得分:0)

  

[错误]没有为此版本指定目标

您必须在调用mvn命令时为Maven指定目标,或在defaultGoal

中添加pom.xml
<project>
  ...
  <build>
    <defaultGoal>install</defaultGoal>
    ...
  </build>
  ...
</project>

参考Hive-NoGoalSpecifiedException

答案 1 :(得分:0)

使用

运行构建
mvn install