在pom.xml中指定目标 [英] specifying goal in pom.xml

查看:212
本文介绍了在pom.xml中指定目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 pom.xml 创建一个新的maven项目,如下所示: -

 code>< project xmlns =http://maven.apache.org/POM/4.0.0xmlns:xsi =http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation =http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">
< modelVersion> 4.0.0< / modelVersion>

< groupId> firstRestlet< / groupId>
< artifactId> restlet1< / artifactId>
< version> 0.0.1-SNAPSHOT< / version>
< packaging> war< / packaging>

< name> restlet1< / name>
< url> http://maven.apache.org< / url>
< repositories>
< repository>
< id> maven-restlet< / id>
< name>公共在线Restlet存储库< / name>
< url> http://maven.restlet.org< / url>
< / repository>
< / repositories>
<属性>
< project.build.sourceEncoding> UTF-8< /project.build.sourceEncoding>
< / properties>

<依赖关系>
<依赖关系>
< groupId> junit< / groupId>
< artifactId> junit< / artifactId>
< version> 3.8.1< / version>
< scope> test< / scope>
< / dependency>
< / dependencies>
< / project>

我所面临的问题是目标战争文件未生成。
在我运行这个 pom.xml 之后的eclipse控制台我发现是 pom.xml中缺少的目标



ECLIPSE控制台消息:

 没有为此构建指定任何目标。您必须以< plugin-prefix>格式指定有效的生命周期阶段或目标:< goal>或< plugin-group-id>:< plugin-artifact-id> [:< plugin-version>]:< goal> ;.可用的生命周期阶段是:验证,初始化,生成源,进程源,生成资源,进程资源,编译,进程类,生成测试源,进程测试源,生成测试资源,进程测试资源,测试编译,流程测试类,测试,准备包,包,预集成测试,集成测试,后整合测试,验证,安装,部署,预清洁,清理,后整理,网站前,站点,站点后,站点部署。 - > [帮助1] 
[错误]

请告诉我如何在 pom.xml



还要告诉我如何使用maven作为构建工具来创建RESTLET项目。



谢谢&请问,

解决方案

您指定的错误消息只不过是您没有指定maven构建的目标。 b
$ b

您可以在运行配置中为maven构建指定任何目标,如清除,编译,安装,打包。



请按照下面的步骤


  1. 右键单击您的项目。

  2. 点击运行方式,然后选择'Maven Build'

  3. 编辑配置窗口将打开。写任何目标,但您的问题具体在目标文本框中写'包'。

  4. 点击'运行'


I am creating a new maven project with pom.xml as below:-

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>firstRestlet</groupId>
  <artifactId>restlet1</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>

  <name>restlet1</name>
  <url>http://maven.apache.org</url>
  <repositories>
<repository>
   <id>maven-restlet</id>
   <name>Public online Restlet repository</name>
   <url>http://maven.restlet.org</url>
</repository> 
</repositories>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

The problem which i am facing is that target war file is not getting generated. On eclipse console after i ran this pom.xml what i found was goals missing in pom.xml.

ECLIPSE CONSOLE MESSAGE:

No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR] 

Please tell me how to specify goals in pom.xml.

Also tell me how to create RESTLET project using maven as build tool.

Thanks & Regards,

解决方案

The error message which you specified is nothing but you are not specifying goal for maven build.

you can specify any goal in your run configuration for maven build like clear, compile, install, package.

please following below step to resolve it.

  1. right click on your project.
  2. click 'Run as' and select 'Maven Build'
  3. edit Configuration window will open. write any goal but your problem specific write 'package' in Goal text box.
  4. click on 'Run'

这篇关于在pom.xml中指定目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆