简体   繁体   中英

when using eclipse/netbeans, can you make it use the maven to build?

Confused as to building a java spring/mvc web app.

When you use netbeans or eclipse, do you have to use the maven/ant build script?

if you don't use maven/ant, how does netbeans/eclipse perform the build then?

Netbeans has built in support for Maven which is very good. Netbeans' controls are mapped to maven lifecycle commands.

Eclipse has the m2Eclipse plugin. I only used this plugin briefly, but found it lacking. In my opinion Netbeans has far superior support for Maven.

Edit: to clarify, when you click the netbeans green arrow (for building), that button is mapped to the maven package lifecycle, so at that point maven takes over and builds your project. You could just as easily open a terminal and run mvn package to get the same results.

I can only speak for Eclipse. In Eclipse, if you create your project as a "Dynamic Web Project", and put things in the relevant places (ie code goes in the src folder, web content including WEB-INF goes in the WebContent folder and so on), Eclipse will automatically build your project.

However, if you want to build a WAR file to run outside your local testing environment, the only way I know to do that from within Eclipse is to go to Project -> Export and export it manually. If you want to build that automatically, you'll need Ant or Maven.

Which is not to say you can't use Ant or Maven within Eclipse: both are fully supported by plugins.

I use the m2eclipse plugin in Eclipse for handling automatic dependency resolution, but the actual build (within Eclipse) is performed just by compiling any classes on the source path.

I only use Eclipse to handle compiling my classes and prefer to handle "making a build" (ie packaging, etc) from the command line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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