开发者

How can maven be set to require no target for the `mvn` command?

I'm trying to set up a Maven project so that it will build upon receiving the mvn command at the command line without any target such as install or package.

This might seem a strange goal, but I'm guessing that it is the simplest way to fit a new project into an existing architecture.

I've been looking at some old pom.xml files, in an effort to find how this is being defined, with no luck so far. (And too mu开发者_开发技巧ch is different for me to simply copy an old pom.)


I believe you're looking for the <defaultGoal> element. It's part of the BaseBuild Element Set.

The value of the <defaultGoal> element can be either a goal or a life-cycle phase. So for example, if I add this to my pom:

<build>
    <defaultGoal>package</defaultGoal>
</build>

Then I can invoke the mvn command with no arguments and the life-cycle as far as the package phase will be run (as if I had invoked mvn package).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜