将带有* .pom文件的Maven原型项目jar安装到本地仓库 [英] install maven archetype project jar with *.pom file to local repo
问题描述
我是Maven的新手,想知道如何在我的本地仓库中安装原型罐
i`m kinda new to maven and want to know how to install an archetype jar to my local repo
我有一个包含以下文件的目录com.foo:
i got a directory com.foo with the following files:
maven_metadata_local.xml
[1.00.00-SNAPSHOT]
其中包含这些文件
_maven.repository
foo-archetype-1.00.00-SNAPSHOT.jar
foo-archetype-1.00.00-SNAPSHOT.pom
maven_metadata_local.xml
据我了解,我知道有一种方法可以使用此原型构建模板项目,但首先我需要将其安装到本地仓库中 我该怎么办?
from what i read i understand that there is a way to build a template project using this archetype but first i need to install it to my local repo how can i do this?
谢谢
推荐答案
我设法做到了:
我所做的是打开maven_metadata_local.xml
以获得groupId,artifactId和版本
what i did is opened the maven_metadata_local.xml
to get the groupId, artifactId, and version
从该目录运行此命令
mvn install:install-file
-Dfile=foo-archetype-1.00.00-SNAPSHOT.jar \
-DgroupId=com.foo \
-DartifactId=foo-archetype \
-Dversion=1.00.00-SNAPSHOT \
-Dpackaging=jar \
-DgeneratePom=true
完成后(BUILD SUCCESS
),我在本地存储库中获得了构建
转到我要从中创建项目的文件夹
运行此命令
once compleated (BUILD SUCCESS
) i got the build in my local repository
go to a folder from which i want to create a project
run this command
mvn archetype:generate \
-DarchetypeGroupId=com.foo \
-DarchetypeArtifactId=foo-archetype \
-DarchetypeVersion=1.00.00-SNAPSHOT \
-DgroupId=com.mycom \
-DartifactId=myApp \
-Dversion=myversion-SNAPSHOT
在eclipse中,我导入了一个现有的maven项目,右键单击该项目-> maven-> update 我已经准备好完整版本
in eclipse i imported an existing maven project, right click on the project->maven->update and i got the full build ready to work
这篇关于将带有* .pom文件的Maven原型项目jar安装到本地仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!