简体   繁体   中英

Maven and Ant in IntelliJ Idea, Downloading Dependencies

I have very little experience with Ant or Maven, but I am trying to streamline my build process for a project I'm working on. I use IntelliJ Idea for Java development, and I would like to use Ant for my automated builds since IntelliJ can automatically generate my build scripts (which I can then tweak to meet my needs). Rather than keeping all of my dependency jars in Git (the server I am going to be running my automated build from will be pulling from the repo regularly to build automatically), I would like to use Maven to declare dependencies in a pom.xml and let Ant use the maven-ant-tasks to automatically download these dependencies for me.

The problem I am running in to is that IntelliJ Idea does not seem to like the required

<artifact:pom ...></artifact:pom>

elements in my Ant build script... even after installing the maven-ant-tasks jar into my ant/libs folder and declaring the Jar as an external DTD as recommended in this answer from the Jetbrains forum .

I suspect that my lack of experience with Ant may be a problem here (for example, I have multiple modules in my project, each of which has it's own Ant file and pom file, do I have to do these steps in all of these files?), and I also suspect that there is a bug in Idea coming into play here. Have any of you ever accomplished this task, and how?

I never play with the "generate ant build..." of IntelliJ. But your approach seems over complicated.

Maven is suitable for resolving dependencies, but is also the appropriate tool for building your project. In general ant is not required (except if your build process is at some point a little bit complex).

So, in my opinion, you should try to build your project with maven. And if your project is very complex to build, you may call some ant task to do more subtil/complex/special steps of your build. But make sure that maven is the master : maven is able to call ant task using maven-antrun-plugin .

According my experience : maven-antrun-plugin is from far easier to use than maven-ant-tasks.

Additionnaly, if your project is correctly mavenized , it will works very smoothly with IntelliJ.

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