Maven Usage FAQs

Source: Internet
Author: User

1. Update eclipse classpath to join new dependencies
1, in the dependencymanagement, including the version of the dependency information, such as:
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.6.2</version>
</dependency>
2, at the same level of
Dependencies
Join the dependency in the node, such as:
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
3. Use mvn Eclipse:clean to delete the current project configuration file and regenerate it with MVN eclipse:eclipse.
4. Import or refresh the Eclipse project.


2, the project configuration does not use the Pom.xml update problem:
The following error occurred after project configuration was not up-to-date with Pom.xml importing MAVEN project:
Description Resource Path Location Type Project configuration was not up-to-date with pom.xml. Run project configuration update RDC Line 1 Maven configuration problem
The solution is:
Right-click on the project, "Maven"-"Update project Configuration ..." ...
3, how to modify the default GBK resource filtering using platform encoding (GBK actually) to copy filtered resources requires the specified character set:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.2</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
4, does not support the model JDK version problem Maven packaging always appears in Tripapplyaction.java:[267,6]-source 1.3 does not support generics (please use-source 5 or later to enable generics) map<string, object> map = new hashmap<string, object> (); Workaround, specify the JDK version: Add the next paragraph in the Pom.xml file to specify the version you are using, although the correct "Build Path" is configured in Eclipse:
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<target>1.5</target>
<source>1.5</source>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
Rerun mvn clean eclipse:eclipse-dmaven.test.skip=true, then MVN package, problem solved.
5, how to use the command to download dependencies while downloading the source code
1. Use the MAVEN command: mvn dependency:sources to download the source code for the dependent package.
2. Use parameters:-ddownloadsources=true to download the source code jar. -ddownloadjavadocs=true Download the Javadoc package.
7. MAVEN packaging, ignoring test parameters Mvn-dmaven.test.failure.ignore=true package Mvn-dmaven.test.skip=true
8. Web. xml which'll be ignored[warning] warning:selected war files include a web-inf/web.xml which would be ignored (WEBX ML attribute is missing from the war ask, or Ignorewebxml attribute is specified as ' true ') will appear when using MAVEN to compile the project [WARNING] Warni ng:selected war files include a web-inf/web.xml which'll be ignored
Workaround:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<!--
http://maven.apache.org/plugins/maven-war-plugin/
-
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
9, Maven3.04 temporarily does not support the Servlet3 without the Web. XML form [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1: War (Default-war) on project Prospringmvc01:error assembling War:webxml attribute is required (orpre-existing Web-inf/web . xml if executing in update mode)

Maven Usage FAQs

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.