1、項目創建 參考鏈接
https://www.cnblogs.com/wrcold520/p/9087537.html
先創建maven項目,創建方式有兩種:
a:第一種是直接創建maven(maven)項目,好處是簡潔,純粹
b:第二種是創建springboot(spring initializr==》下一步選擇maven項目)項目,缺點是會產生額外的文件 這個比a在pom里面多出parents
2、MAVEN環境的搭建 自行百度 maven環境變量的添加 參考鏈接:https://jingyan.baidu.com/article/acf728fd68b4bef8e510a31c.html 特殊:win10的環境變量沒有分好 前后maven_home名字大小寫一直 仔細查看是否有空格
3、創建測試接口 及對應的測試方法 添加 實體和接口文件夾 package
創建實體快捷鍵 alt+insert 或者右鍵 generate
4、pom文件添加修改 參考 https://blog.csdn.net/hao134838/article/details/78185711
添加生成jar包
<packaging>jar</packaging>
添加maven上傳私有庫路徑
<distributionManagement> <repository> <id>lqs-Test</id> <url>http://*.*.*.*:8081/repository/maven-snapshots/</url> </repository> </distributionManagement>
添加生成帶源碼(方法的文字注釋,方便后期其他項目調用)
<!--打包帶源碼-->
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
5、修改maven的setting.xml
<server> <id>lqs-Test</id> <username>admin</username> <password>admin123</password> </server>
6、maven生命周期控制打包 package
7、找到打包好的文件 cmd 跳轉路徑到jar的父級目錄
執行命令
mvn deploy -Dmaven.test.skip=true
上傳 或者在idea上傳