window_maven

apache-maven-3.6.3\conf\settings.xml
<localRepository>E:/software/repository</localRepository> <mirrors> <mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> </mirrors>
<?xml version="1.0" ?> <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.atguigu.maven</groupId> <!-- 模块名称 --> <artifactId>Hello</artifactId> <!-- 版本号 --> <version>1.0-SNAPSHOT</version> <name>Hello</name> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.0</version> <scope>test</scope> </dependency> </dependencies> </project>
package com.atguigu.maven; public class Hello{ public String sayHello(String name){ return name; } }
package com.atguigu.maven; import org.junit.Test; public class HelloTest{ @Test public void testHello(){ Hello hello =new Hello(); String result=hello.sayHello("zhangshan"); System.out.println(result); } }
(1)mvn clean
(2)mvn compile --原代码编译 --》target Hello.class
(3)mvn test-compile --测试代码编译--》target HelloTest.class
(4)mvn package --创建jar包
(5)mvn install --jar包安装到本地仓库
posted on 2020-09-16 19:22 happygril3 阅读(94) 评论(0) 收藏 举报
浙公网安备 33010602011771号