Question

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_metadata_local.xml
[1.00.00-SNAPSHOT] 

which containes these files

_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?

thanks

Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top