初次接触maven的小白还望老师多多指教。
mvn compile 测试通过 mvn test 未通过
mvn clean compile 通过 mvn test 还是未通过
//路径:D:\maven_object\maven01\src\mian\java\com\imooc\maven01\model
package com.imooc.maven01.model;
public class HelloWorld {
public String sayHello(){
return "Hello World!";
}
}
//路径:D:\maven_object\maven01\src\test\java\com\imooc\maven01\model
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());
}
}
<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>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>