Maven编译器失败

时间:2015-12-17 20:52:06

标签: java eclipse maven

我写过简单的服务。他们应该是战争。我想make mvn clean install。得到这个Stacktrace。我没有找到关于LifeCycleExeption的信息。我试着配置编译器。我有Java 1.8。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile (default-testCompile) on project mt_product-srv: Compilation failure: Compilation failure:
[ERROR] /F:/Drive/Workspace/mt_product-srv/src/test/java/de/meinTellerchen/product/utils/AbstractTestClass.java:[10,43] package de.meinTellerchen.intolerance.enums does not exist
[ERROR] /F:/Drive/Workspace/mt_product-srv/src/test/java/de/meinTellerchen/product/utils/AbstractTestClass.java:[64,44] cannot find symbol
[ERROR] symbol:   variable ReasonEnum
[ERROR] location: class de.meinTellerchen.product.utils.AbstractTestClass
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile (default-testCompile) on project mt_product-srv: Compilation failure
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        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:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        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:497)
        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)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
        at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:911)
        at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:153)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 20 more
[ERROR]
[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/MojoFailureException






<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>
<parent>
    <groupId>de.meinTellerchen</groupId>
    <artifactId>mt_parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>de.meinTellerchen</groupId>
<artifactId>mt_ingredient_srv</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>mt_ingredient_srv</name>
<description>Ingredient Services</description>
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
<dependencies>

    <dependency>
        <groupId>de.meinTellerchen</groupId>
        <artifactId>mt_product</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>de.meinTellerchen</groupId>
        <artifactId>mt_profile</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>de.meinTellerchen</groupId>
        <artifactId>mt_utils</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>

</dependencies>

在Eclipse中,它可以工作。我不知道。你可以帮助休息初学者:)

2 个答案:

答案 0 :(得分:0)

看起来你的编译失败了,因为AbstractTestClass.java试图使用de.meinTellerchen.intolerance.enums包中的枚举ReasonEnum而无法找到它:

[ERROR] /F:/Drive/Workspace/mt_product-srv/src/test/java/de/meinTellerchen/product/utils/AbstractTestClass.java:[10,43] package de.meinTellerchen.intolerance.enums does not exist
[ERROR] /F:/Drive/Workspace/mt_product-srv/src/test/java/de/meinTellerchen/product/utils/AbstractTestClass.java:[64,44] cannot find symbol
[ERROR] symbol:   variable ReasonEnum
[ERROR] location: class de.meinTellerchen.product.utils.AbstractTestClass

确保在项目中定义了ReasonEnum,或者在pom中为它添加依赖项。

答案 1 :(得分:0)

我认为你的堆栈跟踪非常明显,你的测试类AbstractTestClass中有一些编译错误。在AbstractTestClass中找不到变量ReasonEnum。

[错误]符号:变量ReasonEnum [错误]位置:class de.meinTellerchen.product.utils.AbstractTestClass。

它可能在eclipse中工作的一种可能性是,如果你检查选项跳过测试,以便它不会运行你的单元测试。