可能的错误中的Maven +丛+月食编译器对大小写敏感的包?(possible bug in Mav

2019-09-29 14:00发布

我遇到与Maven和Eclipse编译一个很奇怪的问题。

虽然在Eclipse + m2eclipse的,我没有问题,编译一个小项目(原型快速启动)与以下单级。

package test.test;
import com.Ostermiller.util.CSVParser;
public class TestCaseSensitive {
    CSVParser csvParser;
}

Ostermiller utils的被添加到pom.xml中。 Eclipse的开普勒编译项目。 接下来,MVN编译作品外的即装即用。

现在的问题,我切换到编译器3.1,并要求为Eclipse编译器(到能够处理在控制台模式相同的编译问题以及IDE模式)。 这是POM:

<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>test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

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

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.ostermiller</groupId>
        <artifactId>utils</artifactId>
        <version>1.07.00</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <compilerId>eclipse</compilerId>
                <source>1.7</source>
                <target>1.7</target>
                <optimize>true</optimize>
                <showWarnings>true</showWarnings>
                <showDeprecation>true</showDeprecation>
                <fork>false</fork>
                <compilerArgument>-err:nullAnnot,null</compilerArgument>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.codehaus.plexus</groupId>
                    <artifactId>plexus-compiler-eclipse</artifactId>
                    <version>2.2</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

现在这里是结果:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project test: Compilation failure: Compilation failure:
[ERROR] /home/me/workspaces/4/3/ws/test/src/main/java/test/test/TestCaseSensitive.java:[3] The import com.Ostermiller cannot be resolved
[ERROR] /home/me/workspaces/4/3/ws/test/src/main/java/test/test/TestCaseSensitive.java:[7] CSVParser cannot be resolved to a type

该包装com.Ostermiller存在(它在行家默认编译器编译以及在Eclipse IDE),但不切换到蚀编译后。

请注意,报告的错误路径也是错误的:

[ERROR] /home/me/workspaces/4/3/ws/test/src/main/java/...

应该

[ERROR] /home/me/workspaces/4.3/ws/test/src/main/java/...

有一个人的想法? 哪儿的潜在错误报告?

Answer 1:

你是否尝试过使用由第谷提供的JDT编译器?

见http://wiki.eclipse.org/Tycho/FAQ#Can_I_use_the_Tycho_compiler_support_in_non-OSGi_projects.2C_too.3F

这会给你:

<plugin>
  <!-- Use compiler plugin with tycho as the adapter to the JDT compiler. -->
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
     <compilerId>jdt</compilerId>
     <source>1.7</source>
     <target>1.7</target>
     <optimize>true</optimize>
     <showWarnings>true</showWarnings>
     <showDeprecation>true</showDeprecation>
     <fork>false</fork>
     <compilerArgument>-err:nullAnnot,null</compilerArgument>
  </configuration>
  <dependencies>
     <!-- This dependency provides the implementation of compiler "jdt": -->
     <dependency>
       <groupId>org.eclipse.tycho</groupId>
       <artifactId>tycho-compiler-jdt</artifactId>
       <version>${tycho-version}</version>
     </dependency>
   </dependencies>
</plugin>

目前,第谷版本= 0.18.0



文章来源: possible bug in Maven + plexus + eclipse compiler on case sensitive packages?