Maven编译失败但没有java错误

时间:2016-12-15 14:20:28

标签: java eclipse maven eclipse-plugin m2eclipse

我正在Eclipse Neon中开发一个编辑器插件。该项目分为父项目,管理它的依赖项和子项目,其中包含实际的源代码。在将我的插件从Eclipse Mars迁移到Neon之后,我将方法IEditorDescriptor editorDescriptor = IDE.getEditorDescriptor(storage.getName(), true);更改为IEditorDescriptor editorDescriptor = IDE.getEditorDescriptor(storage.getName(), true, true);,因为第一个现在已弃用。如果我尝试使用Maven重建项目,它会给我编译失败:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.22.0:compile (default-compile) on project language-editor-core: Compilation failure: Compilation failure:
[ERROR] C:\Users\X\Documents\tfeditor\language-editor-core\src\main\java\de\se_rwth\langeditor\texteditor\hyperlinks\HyperlinkDetectorImpl.java:[228]
[ERROR] IEditorDescriptor editorDescriptor = IDE.getEditorDescriptor(storage.getName(), true, true);
[ERROR] ^^^^^^^^^^^^^^^^^^^
[ERROR] The method getEditorDescriptor(String, boolean) in the type IDE is not applicable for the arguments (String, boolean, boolean)
[ERROR] 1 problem (1 error)
[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
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :language-editor-core

父项目的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>de.monticore</groupId>
    <artifactId>language-editor</artifactId>
    <version>1.0.0-SNAPSHOT</version>

    <name>Language Editor</name>

    <organization>
        <name>Department of Software Engineering, RWTH Aachen University</name>
        <url>http://www.se-rwth.de/</url>
    </organization>

    <packaging>pom</packaging>

    <modules>
        <module>language-editor-core</module>
        <module>cdtrans-editor</module>
        <module>matrans-editor</module>
        <module>language-editor-updatesite</module>
    </modules>

    <properties>
        <monticore.version>4.5.0</monticore.version>
        <monticoreRuntime.version>4.5.0</monticoreRuntime.version>
        <cd4a.version>1.3.7-SNAPSHOT</cd4a.version>
        <cd4a-trans.version>0.0.3-SNAPSHOT</cd4a-trans.version>
        <typestrans.version>0.0.3-SNAPSHOT</typestrans.version>
        <literalstrans.version>0.0.3-SNAPSHOT</literalstrans.version>
        <tfruntime.version>4.4.0-SNAPSHOT</tfruntime.version>
        <odrules.version>4.4.0-SNAPSHOT</odrules.version>
        <secommons.version>1.7.7</secommons.version>
        <antlr.version>4.5</antlr.version>
        <guava.version>18.0</guava.version>
        <matrans.version>0.0.2.E-SNAPSHOT</matrans.version>
        <macommontrans.version>0.0.2-SNAPSHOT</macommontrans.version>


        <tycho.version>0.22.0</tycho.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <wagon.version>1.0</wagon.version>
        <compiler.plugin>3.3</compiler.plugin>
        <java.version>1.8</java.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>de.se_rwth.commons</groupId>
                <artifactId>se-commons-utilities</artifactId>
                <version>${secommons.version}</version>
            </dependency>

            <dependency>
                <groupId>de.monticore</groupId>
                <artifactId>monticore-runtime</artifactId>
                <version>${monticoreRuntime.version}</version>
            </dependency>

            <dependency>
                <groupId>de.monticore</groupId>
                <artifactId>monticore-grammar</artifactId>
                <version>${monticore.version}</version>
            </dependency>

            <dependency>
                <groupId>de.monticore.lang</groupId>
                <artifactId>cd4analysis</artifactId>
                <version>${cd4a.version}</version>
            </dependency>

            <dependency>
                <groupId>de.monticore.lang</groupId>
                <artifactId>cd4a-trans</artifactId>
                <version>${cd4a-trans.version}</version>
            </dependency>

            <dependency>
                <groupId>de.monticore.lang</groupId>
                <artifactId>literalstrans</artifactId>
                <version>${literalstrans.version}</version>
            </dependency>

            <dependency>
                <groupId>de.monticore.lang</groupId>
                <artifactId>typestrans</artifactId>
                <version>${typestrans.version}</version>
            </dependency>

            <dependency>
                <groupId>de.monticore.lang.tf</groupId>
                <artifactId>de.monticore.tf.runtime</artifactId>
                <version>${tfruntime.version}</version>
            </dependency>

            <dependency>
                <groupId>de.monticore.lang.tf</groupId>
                <artifactId>de.monticore.tf.odrules</artifactId>
                <version>${tfruntime.version}</version>
            </dependency>

            <dependency>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4</artifactId>
                <version>${antlr.version}</version>
            </dependency>

            <dependency>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-runtime</artifactId>
                <version>${antlr.version}</version>
            </dependency>

            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>

            <dependency>
                <groupId>de.monticore.lang.tf</groupId>
                <artifactId>matrans</artifactId>
                <version>${matrans.version}</version>
            </dependency>

            <dependency>
                <groupId>de.monticore.lang.tf</groupId>
                <artifactId>macommontrans</artifactId>
                <version>${macommontrans.version}</version>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-maven-plugin</artifactId>
                    <version>${tycho.version}</version>
                    <extensions>true</extensions>
                </plugin>

                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>target-platform-configuration</artifactId>
                    <version>${tycho.version}</version>
                    <configuration>
                        <target>
                            <artifact>
                                <groupId>de.se_rwth.eclipse</groupId>
                                <artifactId>de.se_rwth.eclipse.targetplatform.luna</artifactId>
                                <version>1.0.2-SNAPSHOT</version>
                            </artifact>
                        </target>
                        <pomDependencies>consider</pomDependencies>
                        <environments>
                            <environment>
                                <os>linux</os>
                                <ws>gtk</ws>
                                <arch>x86</arch>
                            </environment>
                            <environment>
                                <os>linux</os>
                                <ws>gtk</ws>
                                <arch>x86_64</arch>
                            </environment>
                            <environment>
                                <os>win32</os>
                                <ws>win32</ws>
                                <arch>x86</arch>
                            </environment>
                            <environment>
                                <os>win32</os>
                                <ws>win32</ws>
                                <arch>x86_64</arch>
                            </environment>
                            <environment>
                                <os>macosx</os>
                                <ws>cocoa</ws>
                                <arch>x86_64</arch>
                            </environment>
                        </environments>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>wagon-maven-plugin</artifactId>
                    <version>${wagon.version}</version>
                    <executions>
                        <execution>
                            <id>deploy-repository</id>
                            <phase>deploy</phase>
                            <goals>
                                <goal>upload-single</goal>
                            </goals>
                            <configuration>
                                <fromFile>${project.build.directory}/${project.build.finalName}.zip</fromFile>
                                <serverId>se-nexus</serverId>
                                <url>https://nexus.se.rwth-aachen.de/service/local/repositories/monticore-snapshots/content-compressed</url>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>3.0.1</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <distributionManagement>
        <repository>
            <id>se-nexus</id>
            <url>http://nexus.se.rwth-aachen.de/content/repositories/monticore-releases/</url>
        </repository>
        <snapshotRepository>
            <id>se-nexus</id>
            <url>http://nexus.se.rwth-aachen.de/content/repositories/monticore-snapshots/</url>
        </snapshotRepository>
        <site>
            <id>se-nexus</id>
            <url>dav:http://nexus.se.rwth-aachen.de/content/sites/se-sites/monticore/${project.version}/</url>
        </site>
    </distributionManagement>

    <repositories>
        <repository>
            <id>se-public</id>
            <url>http://nexus.se.rwth-aachen.de/content/groups/public</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>se-public</id>
            <url>http://nexus.se.rwth-aachen.de/content/groups/public</url>
        </pluginRepository>
    </pluginRepositories>

</project>

Eclipse中没有将代码中的特定行标记为错误,并且代码的执行也很有效,那么问题出在哪里?

2 个答案:

答案 0 :(得分:0)

确实,在将Eclipse Neon存储库添加到pom.xml之后:

<repositories>
        <repository>
            <id>eclipse-neon</id>
            <url>http://download.eclipse.org/releases/neon</url>
            <layout>p2</layout>
        </repository>
    </repositories>

,Maven构建有效并且不会将editorDescriptor = IDE.getEditorDescriptor(storage.getName(), true, true);标记为错误 - &gt;问题解决了

答案 1 :(得分:-1)

做一个

  

mvn clean

并尝试再次构建