maven报 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile(defalut-compile) on project 项目名称:No such compile 'javac'

这个问题纠结了一天,在另外一个电脑是正常的,但是从服务器下载下来到另外一个电脑的时候却出现了如下图问题

看到javac大家都会想到是编译出现问题,而本地的配置如下图所示:

看着配置都是一致的,会是哪里的问题呢?经网上咨询有个大神说是可能是maven没有配置指定的jdk原因,原因如下:

  maven是个项目管理工具,如果我们不告诉它我们的代码要使用什么样的jdk版本编译的话,它就会用maven-compiler-plugin默认的jdk版本来进行处理,这样就容易出现版本不匹配的问题,以至于可能导致编译不通过的问题。为了处理这一种情况的出现,在构建maven项目的时候,我习惯性第一步就是配置maven-compiler-plugin插件。解决办法:

在pom.xml中指定使用的版本 1 <build>

 2         <plugins>
 3             <plugin>
 4                     <groupId>org.apache.maven.plugins</groupId>
 5                     <artifactId>maven-compiler-plugin</artifactId> <!-- 使用3.5.1也是正确 不知道为啥 如果是3.0就是错误的,但是maven里面也有3.0的版本,可能跟我电脑安装的maven版本有关,本地按照maven版本为3.0.5 -->
 6             <version>3.1</version>    
 7                     <configuration>
 8                         <defaultLibBundleDir>lib</defaultLibBundleDir>
 9                         指定高版本的源码和编译后的字节码文件
10                         <source>1.6</source>
11                         <target>1.6</target>
12                         <optimize>true</optimize>
13                         <debug>true</debug>
14                         <showDeprecation>true</showDeprecation>
15                         <showWarnings>true</showWarnings>
16                         <encoding>UTF-8</encoding>
17                     </configuration>
18                 </plugin>
19
20         </plugins>
21     </build>

经过指定后,电脑可以正常运行了。

问题2:

1 [WARNING]
2 [WARNING] Some problems were encountered while building the effective model for com.xxx.xxx:xxxx:jar:0.0.1-SNAPSHOT
3 [WARNING] ‘build.plugins.plugin.version‘ for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 72, column 12
4 [WARNING]
5 [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
6 [WARNING]
7 [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
8 [WARNING] 

对照官网用法:http://maven.apache.org/plugins/maven-compiler-plugin/usage.html

起初配置:

 1 <plugins>
 2     <plugin>
 3         <artifactId>maven-compiler-plugin</artifactId>
 4         <configuration>
 5             <source>1.6</source>
 6             <target>1.6</target>
 7             <encoding>UTF-8</encoding>
 8         </configuration>
 9     </plugin>
10 </plugins> 

该问题解决办法是需要置顶maven版本,解决办法:

 1 <plugins>
 2         <plugin>
 3             <artifactId>maven-compiler-plugin</artifactId>
 4             <version>3.0</version>
 5             <configuration>
 6                 <source>1.6</source>
 7                 <target>1.6</target>
 8                 <encoding>UTF-8</encoding>
 9             </configuration>
10         </plugin>
11     </plugins>  

maven报 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile(defalut-compile) on project 项目名称:No such compile 'javac'

时间: 2024-08-25 07:50:48

maven报 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile(defalut-compile) on project 项目名称:No such compile 'javac'的相关文章

maven install Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project web_nanchang

maven打包成war时,报错:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project web_nanchang: Error assembling WAR: webxml attribute is required 原因:找不到web.xml,但是项目中明明有这个文件,在WebContent/WEB-INF/文件夹下,就是识别不了解决方法:需要在pom

Maven错误“Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create ”解决

用maven3新建一个项目时,输入的命令如下: mvn archetype:create 出现错误如下: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create (default-cli) on project standalone-pom: Unable to parse configuration of mojo org.apache.maven.plugins:mav

maven笔记——Failed to execute goal org.apache.rat:apache-rat-plugin:0.7:check (verify.rat) on project flume-ng-c

解决办法: 在每个新建的类的第一行加入以下内容即可 /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF l

Maven项目报错:Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clea

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project study-search: Failed to clean project: Failed to delete D:\Pxxtarget\tomcat\logs\access_log.2017-3-24 [ERROR] [ERROR] To see the full stac

mvn install 报错Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2 错误: 找不到符号

报错信息 在Eclipse中执行mvn install时,console端显示如下报错信息: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project ERP: Compilation failure: Compilation failure: [ERROR] \test01\src\main\java\HStyl

jenkins运行报错:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project lego

起因:我要对4000条数据循环请求搜索接口,校验返回值,然后在Jenkins上面运行的时候报错:maven-surefire-plugin执行test失败,但是运行70条数据的时候就不会报错,而且程序本身也没有错误,猜测应该是数据量大导致的.通过查阅网上的资料说是要设置surefire插件的jvm 参数. Jenkins运行报下面的错误: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:te

maven打包报错:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.5:test

mvn compile  没有问题,mvn package的时候报如下错误: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.5:test 解决方法: 打包跳过测试有两种方法 一是命令行, mvn clean package -Dmaven.test.skip=true 二是写入pom文件, <plugin> <groupId>org.apache.maven.plugins</g

maven打包报错:Failed to execute goal org.apache.maven

mvn compile  没有问题,mvn package的时候报如下错误: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.5:test 解决方法: 打包跳过测试有两种方法 一是命令行,mvn clean package -Dmaven.test.skip=true 二是写入pom文件,<plugin>          <groupId>org.apache.maven.plugin

[转]maven打包报错:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.5:test

源文URL:http://blog.csdn.net/caiwenfeng_for_23/article/details/44514947 mvn compile  没有问题,mvn package的时候报如下错误: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.5:test 解决方法: 打包跳过测试有两种方法 一是命令行,mvn clean package -Dmaven.test.skip=tr