Maven无法执行目标编译

时间:2019-03-26 14:27:20

标签: maven pom.xml maven-compiler-plugin

我正在从终端在Solaris服务器上使用mvn compile编译一个简单的maven应用程序,并且出现以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project maven-demo: Compilation failure -> [Help 1]

这是我的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>MavenTest</groupId>
  <artifactId>maven-demo</artifactId>
  <version>0.0.1-SNAPSHOT</version>

    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
    </properties>

    <build>
        <plugins>
            <plugin> 
                 <artifactId>maven-compiler-plugin</artifactId> 
                 <version>3.6.1</version> 
                 <configuration>         
                     <fork>true</fork>
                     <source>1.8</source>
                     <target>1.8</target>
                     <executable>/usr/jdk/instances/jdk1.8.0</executable> 
                 </configuration> 
            </plugin> 
        </plugins>
    </build>

    </project>

1 个答案:

答案 0 :(得分:1)

您的<executable>不是javac。您需要指定完整路径,而不是目录。