idea中maven-web项目打包报错: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin

maven项目打包报错:

原因:

   未知...(知道的说下!)

解决方案:

 XML Code 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

 

修改之前的plugin节点:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.1</version>
  <configuration>
    <source>1.8</source>
    <target>1.8</target>
    <encoding>UTF-8</encoding>
    <compilerArguments>
      <extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs>
    </compilerArguments>
  </configuration>
</plugin>
修改之后的plugin节点:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.1</version>   
  <configuration>
    <source>1.8</source>  <!-- 源代码使用的开发版本 -->
    <target>1.8</target>    <!-- 需要生成的目标class文件的编译版本 -->

<!-- 注:

一般而言,target与source是保持一致的,但是,有时候为了让程序能在其他版本的jdk中运行(对于低版本目标jdk,源代码中需要没有使用低版本jdk中不支持的语法),会存在target不同于source的情况 -->

<!-- 这下面的是可选项 -->
    <fork>true</fork>     <!-- fork is enable,用于明确表示编译版本配置的可用   解决该问题的关键 -->
    <executable>C:\Java\jdk1.8.0_151\bin\javac</executable>
    <encoding>UTF-8</encoding>

<!-- 这个选项用来传递编译器自身不包含但是却支持的参数选项 --> 

    <compilerArguments>
      <extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs>
    </compilerArguments>
  </configuration>
</plugin>

     

猜你喜欢

转载自blog.csdn.net/o_nianchenzi_o/article/details/81138149
今日推荐