When you create a MAVEN project template by mvn archetype:generate This interaction, you often get stuck in the generating project in Interactive mode prompt (Figure 1).Read the online post (the article at the bottom of the note), found to get archetype-catalog.xml caused by (browser access to Http://repo1.maven.org/maven2/archetype-catalog.xml, need to wait a long time to get to).In fact, the download will
needs to download the required plugins from the Web.
The following steps can be problematic if the initial exposure to Maven is possible, but first, the focus is on explaining some concepts later.
Next execute the command$mvn archetype:generate -DgroupId=com.mycompany.helloworld -DartifactId=helloworld -Dpackage=com.mycompany.helloworld -Dversion=1.0-SNAPSHOTThe Archetype:generate goal will list a series of archetype to make you choose.
. decompress the apache-maven-2.0.10-bin.zip to the directory you want, such as/usr/local/Apache-Maven, then the decompressed directory is/usr/local/Apache-Maven/apache-maven-2.0.102. export m2_home =/usr/local/Apache-Maven/apache-maven-2.0.103.export m2 = $ m2_home/bin4. (optional) Optional environment variable maven_opts, for example if you want to change Java heap (HEAP) you can set the value to-xms256m-xmx512m. This option is very useful in some cases, when you use MVN site to generate a sit
plug-ins, there are a lot of plug-ins available for selection, such as plug-ins combined with eclipse and plug-ins related to test, later we will introduce Maven in detail in the project.
Figure 1
2. Project Management
Maven officially defines Maven as a project management tool. Let's take a look at what kind of support Maven can provide to our project.2.1 Project StandardizationAn important feature of Maven is to define the standard template of the project. The official saying is best practice
information, see "next". That is, create an empty maven project without using any archetype.
Next, enter the maven coordinate 3 elements (GroupId, ArtifactId, Version) and continue Next
Next, enter the Module name. I personally think it should be improved here. The best Module name is the ArtifactId you just entered by default, which can reduce user input and click Finish.
You can see that the folder structure is displayed in the Project directory
complete, run the following command on the command line:
$ MVN-VApache Maven 3.0.3 (r00005438; 01:31:09 + 0800)Maven home:/home/Limin/bin/maven3Java version: 1.6.0 _ 24, vendor: Sun Microsystems Inc.Java home:/home/Limin/bin/jdk1.6.0 _ 24/JREDefault locale: en_us, platform encoding: UTF-8OS name: "Linux", version: "2.6.35-28-generic-pae", arch: "i386", family: "Unix"If you see the above output, it indicates that the installation is successful.Next we will use Maven to build the most famous "He
line to build our Hello World project~ $MVN archetype:generate-dgroupid=com.mycompany.helloworld-dartifactid=helloworld-dpackage= Com.mycompany.helloworld-dversion=1.0-snapshotThe Archetype:generate goal will list a series of archetype to make you choose. Archetype can be understood as a model of the project. Maven provides us with a variety of project models, from simple Swing to complex Web applications.
The tools you need:
Maven 3.3.3
Eclipse 4.2
JDK 8
Note: Make sure that Maven is properly installed and configured (in the Windows,*nix,mac OSX system), and then start this tutorial to avoid the MVN command not finding errors. 1. Create a project from the Maven templateIn the terminal (* Unix or Mac) or command prompt (Windows), browse to the folder where you want to create the Java project. Type the following command:MVN archetype
1. Error: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:release from any of the Configured repositories.Could not resolve artifact Org.apache.maven.archetypes:maven-archetype-quickstart:pom:releaseFailed to resolve version for Org.apache.maven.archetypes:maven-archetype-quickstart:p
, consistent with the App.name name in Application.properties under the Grails project root.
Packaging
The value is Grails-app, which indicates that apps are grails apps, so packaging is packaged with grails apps.
Version
The current version of the project must be consistent with the app.version content in Application.properties.
Name
The name of the project.
Description
Description of the project.
Properties
Set the
In addition to ant, Maven is the most common project management tool, which is invisible in daily project development. Below is a brief introduction to Maven installation and basic commands.
1.download the maveninstallation file apache-maven-3.2.3-bin.zip. The latest version is 3.2.3. decompress it to the specified directory.
2. Set Environment Variables
M2_home: D: \ Java \ apache-maven-3.2.3-bin \ apache-maven-3.2.3
Path: D: \ Java \ apache-maven-3.2.3-bin \ apache-maven-3.2.3 \ bin or % m2_h
-dartifactid=helloworld-dpackage= Com.mycompany.helloworld-dversion=1.0-snapshotThe Archetype:generate goal will list a series of archetype to make you choose. Archetype can be understood as a model of the project. Maven provides us with a variety of project models, from simple Swing to complex Web applications. We select the default Maven-archetype-quickstart, w
Using MAVEN with eclipse requires installing the Maven plugin for Eclipse, specifically installing MAVEN plugin installation related articlesBuilding a MAVEN ProjectTaking eclipse3.6 as an example1) Create a simple MAVEN projectClick the Eclipse menu bar File->new->ohter->maven to get the dialog box as shown:Select Maven Project and click NextGo to the next dialog box and click Next to get the following dialog boxSelect Maven-archetype-quickstart, cli
the MAVEN local warehouse address to D:\java\ Repository, the following sections describe how to customize the local warehouse location.Create a MAVEN projectIt's also easy to create a MAVEN project, choose menu Item--- new--and other, select Maven Projectunder Maven in the Pop-up dialog box, then click Next > , in the New Maven Project dialog box that pops up, we use the default options (don't choose the createa simple Project option so we can use Maven ar
comments. 2. Create a MVN project and refine the directory structure
First install and configure the environment, mainly including JDK, MySQL, maven, etc., other such as Redis, Nginx, ACTIVEMQ, etc. in the initial version has not been uploaded and used. These introductory knowledge will not be mentioned.
Create a new MVN project on idea, and then have a create from archetype, which has a lot of options, so there's a question in which to use. So one b
Add by Zhj: Although it was a few years ago, it is a valuable reference.Original: http://blog.zhaojie.me/2010/05/programmer-magazine-2010-5-architect.htmlLast month, the programmer magazine Manuscripts me, hoping I could take part in the May "architect Solitaire" column, and I hesitated a little bit and agreed. "Architect Solitaire" is a question-and-answer form, with one person asking each question and answering by another. The answer is the next issue of the questioner. The architect of this q
service-level requirements in the SOA Architecture
In addition to the business needs of the system, the architecture designer must ensure that the constructed system architecture can meet the non-functional service-level requirements and QoS requirements of the system) requirements. In the initial and refined phases of the project, architects should, together with all systems involved (stakeholders), define relevant measurement standards for each ser
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.