开发者

Why maven requires so many options to create a hello world project,can you recommend a more dedicated build tool for Java? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 9 years ago.

Improve this question

Quoted from here:

mvn archetype:generate -DgroupId=org.sonatype.mavenbook.simple \
                                         -DartifactId=simple \
                开发者_如何学运维                         -DpackageName=org.sonatype.mavenbook \
                                         -Dversion=1.0-SNAPSHOT

And I also have to specify an archetype number...

It seems that maven isn't satisfied to be just a Java build tool,but want to control all aspect of developing...

Can someone recommend a really dedicated build tool for Java?


You're misunderstanding what an archetype is, it's simply a template for creating new projects.

You don't need to use one if you don't want to, you are free to create your own pom.xml and put your source code and tests wherever you want, as long as you configure the non-standard values in your POM.

Maven doesn't "want to control all aspect of developing", it is a tool which is based around a set of best practices and standards (standard layouts, build lifecycle, projects should have versions, the idea of release vs snapshot dependencies, etc.).

You are free to not use these best practices, but to do so, you need to configure Maven for what you want.

The nice part about Maven is that when you do follow the standards, there is often nothing to configure. It's only when you need non-standards that you need to configure.


A Maven project has a groupId, an artifactId and a version (OMG, 3 properties) so you need to set them:

mvn archetype:generate -B -DgroupId=org.sonatype.mavenbook.simple \
                          -DartifactId=simple \
                          -Dversion=1.0-SNAPSHOT 

You don't like it? It's too much effort? Don't use Maven.

It seems that maven isn't satisfied to be just a Java build tool, but want to control all aspect of developing...

Maven is more than just a build tool. It's not what you want? Don't use Maven.

Can someone recommend a really dedicated build tool for Java?

It's the third time you ask for recommendations (first time here, second time here) and since you're just ignoring the answers suggesting Maven, Ant, Make, Buildr, Gradle, Gant, I would recommend javac.


Alternate build tools: Ant (lots of configuration), Gradle (conventions again, less verbose than maven)

Maven is good if you don't want to fight its conventions. Your example above is just asking you to define your package, jar name, and version string (all things you need to do if this code is ever going to other people). Also you don't need to start with an archetype if you understand how to (or have a tool) to generate a pom and understand where maven wants you to put your files.


I recommand you buildr (http://buildr.apache.org/) : it's very simple to use, very powerfull and it's compatible with maven2 repos. I really love this tool.

Extract from the buildr website :

Apache Buildr is a build system for Java-based applications, including support for Scala, Groovy and a growing number of JVM languages and tools. We wanted something that’s simple and intuitive to use, so we only need to tell it what to do, and it takes care of the rest. But also something we can easily extend for those one-off tasks, with a language that’s a joy to use. And of course, we wanted it to be fast, reliable and have outstanding dependency management.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜