为了账号安全,请及时绑定邮箱和手机立即绑定

mvn compile 没通过

<?xml version="1.0" encoding="UTF-8"?>


<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

<groupId>com.imooc.maven01</groupId>

<artifactId>maven01-model</artifactId>

<version>0.0.1-SNAPSHOT</version>

<dependencies>

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>4.10</version>

</dependency>

</dependencies>

</project>

package com.imooc.maven01.model;


public class HelloWorld{

public String sayHello(){

return "HelloWorld";

}



}

package com.imooc.maven01.model;

import org.junit.*/;

import org.junit.Assert.*;




public class HelloWorldTest{

@Test

public void testHello(){

Assert.assertEquals("Hello World!",new HelloWorld.sayHello());

}

}

结果:


F:\java tool\code\maven01>mvn compile

[INFO] Scanning for projects...

[INFO]

[INFO] ------------------< com.imooc.maven01:maven01-model >-------------------

[INFO] Building maven01-model 0.0.1-SNAPSHOT

[INFO] --------------------------------[ jar ]---------------------------------

[INFO]

[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven01-model ---

[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!

[INFO] skip non existing resourceDirectory F:\java tool\code\maven01\src\main\resources

[INFO]

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven01-model ---

[INFO] Changes detected - recompiling the module!

[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!

[INFO] Compiling 1 source file to F:\java tool\code\maven01\target\classes

[INFO] -------------------------------------------------------------

[ERROR] COMPILATION ERROR :

[INFO] -------------------------------------------------------------

[ERROR] 不再支持源选项 5。请使用 6 或更高版本。

[ERROR] 不再支持目标选项 1.5。请使用 1.6 或更高版本。

[INFO] 2 errors

[INFO] -------------------------------------------------------------

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time:  2.545 s

[INFO] Finished at: 2019-08-14T12:41:32+08:00

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project maven01-model: Compilation failure: Compilation failure:

[ERROR] 不再支持源选项 5。请使用 6 或更高版本。

[ERROR] 不再支持目标选项 1.5。请使用 1.6 或更高版本。

[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

F:\java tool\code\maven01>



正在回答

2 回答

你好问一下你这个问题怎么解决的呀  我也遇到了同样的问题

0 回复 有任何疑惑可以回复我~

是不是需要将maven项目中的jre改到1.7之类的

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
项目管理利器——maven
  • 参与学习       173090    人
  • 解答问题       742    个

使用maven来构建和管理Java项目,从环境配置,到maven核心知识

进入课程

mvn compile 没通过

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信