Eclipse中{Maven [编译错误]中的多个额外源目录

时间:2015-05-02 10:01:15

标签: java eclipse maven pom.xml

我正在开发一个“复杂”/“结构良好”的Maven项目,特别是我正在研究项目的单个内部模块。我反对COMPILE ERROR,因为它似乎找不到已从菜单链接的外部源的Java类(右键单击项目) - > Build Path-> Link Source。 这是我运行时从控制台获取的一系列重要错误 - > mvn:编译

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project optimizer: Compilation failure: Compilation failure:
[ERROR] /Users/Ste/Desktop/eclip/workspace/planner/src/main/java/eu/planner/Module.java:[24,19] package jmetal.core does not exist
[ERROR] /Users/Ste/Desktop/eclip/workspace/planner/src/main/java/eu/planner/Module.java:[35,29] cannot find symbol
[ERROR] symbol: class Variable
[ERROR] /Users/Ste/Desktop/eclip/workspace/planner/src/main/java/eu/planner/Module.java:[39,11] cannot find symbol
[ERROR] symbol:   class Problem
[ERROR] location: class eu.planner.Module
[INFO] 100 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.090 s
[INFO] Finished at: 2015-05-02T10:46:45+01:00
[INFO] Final Memory: 21M/219M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project optimizer: Compilation failure: Compilation failure:
[ERROR] /Users/Ste/Desktop/eclip/workspace/planner/src/main/java/eu/planner/heuristics/SVariable.java:[234,9] method does not override or implement a method from a supertype
[ERROR] /Users/Ste/Desktop/eclip/workspace/planner/src/main/java/eu/planner/heuristics/SVariable.java:[237,24] cannot find symbol
[ERROR] symbol:   variable super
[ERROR] location: class eu.planner.heuristics.SVariable
[ERROR] -> [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/MojoFailureException

添加-X它显示DEBUG,但没什么奇怪的。它只是在最后添加这些信息:

[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project optimizer: 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:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    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:483)
    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:858)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 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

我还尝试添加我正在处理的模块的POM,这个构建助手从这里http://mojo.codehaus.org/build-helper-maven-plugin/usage.html取得(没有成功):

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals><goal>add-source</goal></goals>
            <configuration>
                <sources>
                    <source>/Users/Ste/Desktop/externalFolderWithJavaClasses<source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

plugin元素位于/project/build/plugins而不是/project/build/pluginManagement/plugins

我检查了项目的target/classes文件夹,它是空的。

我不是从任何其他项目导入文件。刚刚从我的文件系统链接了一个文件夹。 您在屏幕截图中看到的路径与您在编译错误中看到的路径不同,因为在开始时我认为不显示我的真实路径。 这里有2个截图:

Source Folder View inside my Project with its content

Java Build Path (the Project Tab is empty, no projects linked)

有谁知道出了什么问题?非常感谢你

P.S。我正在使用Mac OS X x64,Eclipse Luna,并且该项目是从GitHub存储库中获取的,如果对某人来说这个信息是基本的。

0 个答案:

没有答案
相关问题