简体   繁体   English

从(Eclipse)项目创建Maven工件,并从中生成新项目

[英]Creating a Maven Artifact from (Eclipse) Project, and Generating New Project from it

I have an Maven (eclipse) Project, which i want to convert to an Maven Artifact - so that others can generate new Project from it. 我有一个Maven(Eclipse)项目,我想将其转换为Maven Artifact-这样其他人可以从中生成新项目。

To create Artifact i did: 要创建工件,我做了:
cd to my proj dir where pom.xml exists cd到存在pom.xml的我的项目目录

mvn install

After this i can see that 之后,我可以看到
.m2\\repository has my project added. .m2 \\ repository添加了我的项目。
But <user_home>\\.m2\\archetype-catalog.xml - did not have the archetype added. 但是 <user_home> \\。m2 \\ archetype-catalog.xml-没有添加原型。
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] [错误]无法在独立项目pom上执行目标org.apache.maven.plugins:maven-archetype-plugin:2 .2:generate(default-cli):所需的原型不存在(com.whatever:myapp: 1.0.0-BUILD-SNAPSHOT)-> [帮助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 此处列出了完整的步骤: http : //hello-its-crazy.blogspot.in/2012/08/steps-to-create-maven-archetype-from.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM