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,
From the main menu, select Run | Edit Configurations to open the run/debug configuration for your project. In the list that opens, select Run Maven Goal. In the Select Maven Goal dialog, specify a project and a goal that you want to execute before launching the project. Click OK.
Maven goals represent a specific task that contributes to the building and managing of a project. Sometimes, a maven goal is not bound to a build phase. We can execute these goals through the command line.
Right-click Maven Build, and click New. Enter a configuration name, and click Select to select the goals you want to run. Note: If you click the Select button to specify goals and the goals list is empty, you need to enable the full repository index.
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.
I've bumped into this question because I actually wanted to define a default goal in pom.xml. You can define a default goal under build:
<build> <defaultGoal>install</defaultGoal> ... </build>
After that change, you can then simply run mvn
which will do exactly the same as mvn install
.
Note: I don't favor this as a default approach. My use case was to define a profile that downloaded a previous version of that project from Artifactory and wanted to tie that profile to a given phase. For convenience, I can run mvn -Pdownload-jar -Dversion=0.0.9
and don't need to specify a goal/phase there. I think it's reasonable to define a defaultGoal
in a profile which has a very specific function for a particular phase.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With