maven无法创建父目录

时间:2014-09-09 11:03:37

标签: maven maven-3

我有一个项目,我正在用pmacct测试opennms。我的安装环境是Linux Ubuntu 14.04LTS。 opennms-pmacct包在github上可用,如下所示

opennms-pmacct

我的理解是,当您发出mvn compile时,它会自动为您创建目标目录...请您帮我解决此问题。

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building OpenNMS Support for Pmacct 1.12.9
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ opennms-pmacct ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /usr/local/src/opennms-pmacct-master/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ opennms-pmacct ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /usr/local/src/opennms-pmacct-master/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.921s
[INFO] Finished at: Tue Sep 09 10:11:23 EDT 2014
[INFO] Final Memory: 16M/38M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project opennms-pmacct: Fatal error compiling: directory not found: /usr/local/src/opennms-pmacct-master/target/classes -> [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/MojoExecutionException

编辑1 - 文件pom.xml

<parent>
                <groupId>org.opennms</groupId>
                <artifactId>opennms</artifactId>
                <version>1.12.9</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
        <artifactId>opennms-pmacct</artifactId>
        <name>OpenNMS Support for Pmacct</name>
        <packaging>jar</packaging>
        <build>
                <plugins>
                        <plugin>
                                <groupId>org.opennms.core.build</groupId>
                                <artifactId>castor-maven-plugin</artifactId>
                                <version>1.10.0</version>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-jar-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <goals>
                                                        <goal>test-jar</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>
                        <plugin>
                                <artifactId>maven-surefire-plugin</artifactId>
                                <configuration>
                                        <systemPropertyVariables>
                                                <opennms.home>${project.build.testOutputDirectory}</opennms.home>
                                        </systemPropertyVariables>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-eclipse-plugin</artifactId>
                                <configuration>
                                        <additionalBuildcommands>
                                                <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                                        </additionalBuildcommands>
                                        <additionalProjectnatures>
                                                <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                                        </additionalProjectnatures>
                                </configuration>
                        </plugin>
                </plugins>
        </build>

1 个答案:

答案 0 :(得分:0)

为您的项目定义<packaging>jar</packaging>。它目前被视为<packaging>pom</packaging>,而您不会获得jar