I have an Maven (eclipse) Project, which i want to convert to an Maven Artifact - so that others can generate new Project from it.

To create Artifact i did:
cd to my proj dir where pom.xml exists

mvn install

After this i can see that
.m2\repository has my project added.
But <user_home>\.m2\archetype-catalog.xml - did not have the archetype added.
So, i added manually as follows:

<archetype>
      <groupId>com.whatever</groupId>
      <artifactId>myapp</artifactId>
      <version>1.0.0-BUILD-SNAPSHOT</version>
      <repository></repository>
</archetype>

Now, i am not sure what to give in tag, as this is a local repository.

But, i am unable to generate a new project using:

mvn archetype:generate -DarchetypeCatalog=local

It asks me to choose the archetype, but after that i get error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2 .2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.whatever:myapp:1.0.0-BUILD-SNAPSHOT) -> [Help 1]

What step am i missing?

有帮助吗?

解决方案

You need to run the archetype plugin from within your original project to generate an archetype descriptor.

Here is an example of how to do this.

The complete steps are listed here: http://hello-its-crazy.blogspot.in/2012/08/steps-to-create-maven-archetype-from.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top