共計 1478 個字符,預計需要花費 4 分鐘才能閱讀完成。
本篇內容介紹了“IDEA+Maven 怎么實現簡單的 demo”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓丸趣 TV 小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
1、在 IDEA 下新建 Maven 工程,并選擇 webapp 骨架
2、設置工程屬性
3、按照 Maven 的約定,設置文件夾
4、配置 pom.xml
?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/xsd/maven-4.0.0.xsd
modelVersion 4.0.0 /modelVersion
groupId com.zx /groupId
artifactId test-api /artifactId
version 1.0-SNAPSHOT /version
!-- 設定除中央倉庫 (repo1.maven.org/maven2/) 外的其他倉庫, 按設定順序進行查找. --
repositories
!-- 如有 Nexus 私服, 取消注釋并指向正確的服務器地址. --
repository
id nexus /id
name maven2 /name
url 私服 url /url
releases
enabled true /enabled
/releases
snapshots
enabled false /enabled
updatePolicy daily /updatePolicy
/snapshots
/repository
/repositories
pluginRepositories
pluginRepository
id nexus /id
name maven2 /name
url 私服 url /url
releases
enabled true /enabled
/releases
snapshots
enabled false /enabled
/snapshots
/pluginRepository
/pluginRepositories
!-- 把本地項目 deploy 項目到私服 --
distributionManagement
repository
id releases /id
name Nexus Release Repository /name
url 私服 url /url
/repository
snapshotRepository
id snapshots /id
name Nexus Snapshot Repository /name
url 私服 url /url
/snapshotRepository
/distributionManagement
public interface DemoService { String sayHello(String name);
}
6、將 test-api 進行編譯(compile)、打包(package)、部署(deploy)
7、然后私庫上能看到部署上去的 test-api
“IDEA+Maven 怎么實現簡單的 demo”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注丸趣 TV 網站,丸趣 TV 小編將為大家輸出更多高質量的實用文章!
正文完