The process for creating a new MAVEN project (WEBAPP directory structure) in MyEclipse is as follows:1. Maven project, New project ...
2. Next,
3. Next, select "Maven-archetype-webapp" to create a WEBAPP directory structure for project 4. Fill in the group Id,artifact Id, and package (refer to "keywords" below) and click "Finish" 5. Take a break and wait for myeclipse after the creation of the project is complete, the file directory structure is as follows: 6. Modify the project name and storage path (if you don't like the current file name): Refactor, Rename7, right-click Project. Add code directory: Project Right--Build Path, new Source Folder ..., fill in "Src/main/java" (Note: MyEclipse2015 does not have this menu, direct this line: Project right--New-& Gt Folder->folder Name input "Src/main/java", and then repeat step input "Src/test/java") added, the test directory also automatically has: 8. Modify the JDK used by the project (if necessary): Project right---build path, Configure build path ... The final project directory structure is as follows: 9. Add the appropriate plug-in, 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>
Keywords:
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 publishedthe 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> <version>2.5.5</version></dependency>
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