install maven archetype project jar with *.pom file to local repo

后端 未结 2 763
说谎
说谎 2020-12-30 16:28

i`m kinda new to maven and want to know how to install an archetype jar to my local repo

i got a directory com.foo with the following files:

maven_me         


        
相关标签:
2条回答
  • 2020-12-30 17:01

    Adding an archetype to your local repository is no different than adding any other dependency. You can simply run a mvn install command on it.

    0 讨论(0)
  • 2020-12-30 17:15

    i managed to do that:

    what i did is opened the maven_metadata_local.xml to get the groupId, artifactId, and version

    run this command from that directory

    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
    

    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
    

    in eclipse i imported an existing maven project, right click on the project->maven->update and i got the full build ready to work

    0 讨论(0)
提交回复
热议问题