I posted a post on the csdn forum a few days ago because Maven may be used.
Different Opinions: Where is Maven better than ant?
For your comments, we will sort out the discussion as follows:
Original post content:
Ant has been used for a long time. Recently, we have prepared the sonar open-source code quality management platform, which has a lot to do with Maven,
Let's take a look. The first impression is:
Wow!
Complicated!
Colleagues who have used two tools at the same time hope to give us some advice and discuss it:
1. Is Maven really complicated, or does it just look complicated?
2. Where is Maven better than ant?
Thank you!
Daisycool
First, I gave some pertinent comments based on my own practices:
Most of my work is done using maven. A few of my work is Ant. Let's talk about my feelings.
Maven builds a project quickly and does not require special plug-ins or anything, so you can get started with it directly. Ant is very troublesome to get started and needs to write a lot of things. That is to say, Maven has preset some convenient functions, and ant can only write them by itself.
It is troublesome for Maven to modify the default settings. maven1 is a good option, but Maven is used. XML to control, maven2 all integrated into plugin, trouble; ant all in build. in XML, it is easier to modify even though the workload is large during creation.
Maven provides better support for third-party library files, automatically downloads and stores, and can be added to the IDE Working path. It is of great help for library file management and team development. This useful function leads to Engineering
It is very convenient to transplant, without special configuration, as long as you run Maven, You can automatically configure the development environment of the project; ant has not found any special features in this regard, configure and
Debugging is very troublesome.
Rich Maven plug-ins, reducing the workload; ant is based on handwriting. For example, both Maven and ant have the automatic encapsulation and packaging function. However, Maven has many ready-made Plug-ins that can be added to Pom. XML for ease of use. In contrast, ant has a relatively high degree of manual work.
Maven and ant both have a learning process, but ant is more intuitive than maven. After all, XML can be understood at a glance, and Maven functions are based on plug-ins, so it is not easy to understand, however, it is easy to get started once you understand the principles of Maven.
In fact, Maven and ant are similar in terms of jobs and implementation, depending on which one you like to use.
For more information, see LZ.
Then xyz20003
I wrote three articles repeatedly to clarify my views:
Discussion 2, that is to say, the previous writing is useless, alas, so strict.
I still think that, if the upper layer does not move, maven2's pure building stuff will not be used. It's a bit difficult for a new graduate, software development process leader to engage in maven2,
At least he needs to know what maven2 is, what every phase is used for, why should test be placed before package, and why integration-
Test: Why is dependency based on different versions. Why does the directory structure distinguish between main and test? Why does the lower-level directory keep Java and resource separate? Why?
Put the generated files to the target.
If you understand this, you can use ant to write a script similar to maven2, although build. XML will be slightly larger. However, it is flexible and customizable.
It's not that ant is not good. You think spring is compiled with ant. How many scripts have you written?
Finally, I felt like this:
If you write a little tool to play with it, ant is flexible and fast to run.
If you want to share this item with others or meet internal standards of a team, use maven2 as an example of standardization. You can see how many Apache projects are using maven2. The advantage of learning maven2 is that you can quickly understand the structure of these projects and build a project as quickly as possible to reduce barriers to communication.
Therefore, if you are in an enterprise, you do not need to use maven2 to view your hobbies. If you are learning open source, you should learn it quickly.
Ant now releases the package, about 18 m
The maven2 release package, about 2.8 m
The next local repo is about 1 GB, mainly because there are too many previous versions.
But every time you want to add a function for ant, you have to find lib on your own.
Configure one in Maven and download it by yourself.
Some people say that my projects are all over SSH, so I can copy them directly.
I can't compare this. I put an open-source project on Google Code. If I put all Lib, each project is estimated to be hundreds of MB, or maven2, these things should at least not be put in SVN.
In other words, the enterprise is a very small circle. Although maven2 can ensure a part of standardization, it is not as big as open source. So let's make an estimate. If you can figure out the maven2 development process, you can also use ant to write such a script. Plug-ins are configured on their own, depending on their own, the same.
But why do we want to learn maven2, because we don't duplicate the wheel and others have already written it.
I also looked at the LZ problem. It turned out to be because of sonar.
This is an example of an enterprise being kidnapped by open source. You didn't want to learn this thing, but open source is already widely used. Hudson does not know that it also provides good support for maven2? In this case, either give up or compromise.
The result is that when users need to taste the big meals provided by others for free, they need to accept the standards they have already set.
Miaoliujun
This article focuses on the view on dependency:
Maven is suitable for company management. ant can be used for personal private work.
Of course, if you are familiar with Maven and have a mature template, you can use Maven for any project. Ant actually works.
Maven is not only an ant upgrade, but also has a lot of help in project management.
The previous floor mentioned that the dependency package is not online. I think so. It is best to download the dependency package to a public place, so as to ensure the legitimacy of the dependency package, in the company, due to personnel movement and so on
The jar package may have no version information, and some jar Packages may have been modified, which will not be maintained by other users after the confusion. If you cannot access the Internet, there are two solutions: 1. Enter
Download the package over the Internet and create it as an intranet library image. 2. Make sure the package is in the correct version and copy it to the Intranet library image.
As for the complexity, I admit that it is very complicated to understand a concept, but a company only needs to understand it by one person. Others do not need to understand it all and know how to do it.
Xyz20003
For miaoliujun
The complexity problem is explained as follows:
As mentioned above, one or two people in a company can configure maven2, And the rest only need to checkout from SVN and then execute the corresponding goal.
In fact, I still feel that maven2 and other building tools should be used by project management and even project architects. Although the author's "reverse software team management approach" is not bad, it is just like letting people who have never learned any internal skills to practice Qiankun's big shift, so they will never die.
In fact, if the company has an internal Repo, maven2 can achieve plug-in sharing. You can directly deploy the plug-in written internally to the repo. Other people can directly configure and use it through maven2, at this point, it is not that convenient to use ant.
Furthermore, maven2 makes it easy for internal users to force the use of the same directory structure and development process. This is also the reason many open-source support for maven2, because these phase and sequence are all pinned, we only need to call it directly. Ant is too flexible. You can write it at will, and the result is only usable by yourself.
So what are the two options? Is it flexible to choose, and it is difficult to interact with others, or is it possible to accept restrictions and integrate them seamlessly with others?
Self-assurance or group assurance is a problem.
Finally, my Superficial Views after several days of study:
I took the time to read the official Maven documentation and finally had some basic concepts about it.
According to my current knowledge, using Maven is indeed very standard,
In terms of convenience, compared with ant,
In some cases, it is much more convenient, mainly because of its standard directory structure and standard process,
In this way, you need to write scripts for the simplest compilation task and use the default directory structure.
However, in terms of dependency management, I personally feel a little troublesome,
Currently, I have not found a one-time method to add my existing lib to dependencies,
Manual configuration is also required, which is really annoying.
Maven may think that this work is part of the project quality assurance in the project management process (all dependencies are explicitly declared, more accurate ?),
In addition, after the configuration is complete, each project can be inherited or accepted.
Continue to study to see if the workload can be simplified.
In terms of complexity, Maven and ant are not at the same level, and the problems are also quite serious in some cases,
Today, I encountered a situation where downloading a plug-in failed and the entire project was completely unable to be compiled.
For similar problems, if you do not have a deep understanding of Maven, I am afraid it will be quite tricky to solve.
There is no end to learning. Continue to study.