The process for creating a new MAVEN project (WEBAPP directory structure) in MyEclipse is as follows:
- new, Project .... Maven Project
- fill the group Id, Artifact Id, and package (refer to "keywords" below), click "finish"
- (if needed) modify the project name and storage path: Project Right-click Refactor, rename
- add code directory: Project Right--Build Path--New Sour Ce Folder ..., fill in "Src/main/java"
- add the appropriate plug-ins, such as maven-compiler-plugin
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId> maven-compiler-plugin</artifactid> <version>2.3.2</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> < /plugin>
Key Words:GroupId: General company name or organization name Artifactid: typically project name Packaging: Package Type, Jar/war/rar/ear/pom, default is jarversion: Version number, groupid+ Artifactid+packaging+version unique identity of the constituent Project snapshot: Identifies a version that is under development, often updated, but not yet published
the difference between <dependency management> and <dependencies>:Using <dependency management> in the parent Pom to define the version, scope, and exclusions, you can use the dependency that is defined in <dependencies> with a quilt in the Pom. This way, if you have multiple sub-pom, you can make sure to use the same set of version, scope, and exclusions.
Dependency Scope:
- Compile: The default scope. Compiling, testing, and packaging are all needed. Compile participates in dependency passing, that is, project a relies on B (dependent on scope is compile) and Project C relies on your project A, then C also relies on B.
- Provided: Indicates that the JDK or container will provide these (jars) at runtime, such as the Servlet API, which is not required for deployment because the application server must have these things. Provided things are used in compiling and testing, and do not participate in transitive dependencies.
- Runtime: This is not required at compile time, but is required for testing and runtime, and is included in the final package.
- Test: Only for the testing phase (test compilation and test run), typically JUnit jar.
- System: Similar to provided, but requires that the jar is already in the system and will not be found in repository, such as Rt.jar,tools.jar.
- Import: Simply put, the Pom of the project inherits the dependencies of the parent project by inheriting the Pom of the other project, but because of the single inheritance, the import is created so that you can "import" or "Inherit" Dependencies on any one or more projects.
how to find a package:
- Enter in Google: Maven spring repository
- Get:
<dependency> <groupId>org.springframework</groupId> <artifactid>spring</ Artifactid>
When Maven finishes downloading the jar package,
- Stop Server
- Redeploy/reload Application
- Start Server
Or find in this website: http://mvnrepository.com/
(original article, reprint please specify the blog from Clement-xu)
Steps to create a new Maven WebApp project in MyEclipse