MAVEN uses FAQs to organize

Source: Internet
Author: User

MAVEN uses FAQs to organize

1. Update eclipse classpath to join new dependencies

1, in Dependencymanagement include the version of the dependency information, such as: <dependency> <groupId>joda-time</groupId> <ARTIFAC Tid>joda-time</artifactid>
<version>1.6.2</version>

</dependency>

2. Join the dependency in the Dependencies 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 is not used Pom.xml update
Issue: Project configuration is not up-to-date with pom.xml
After importing Maven project, the following error occurred:
Description Resource Path Location Type
Project configuration is not a 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
You need to specify a 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. JDK version issues that do not support generics

Maven 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.
6. Maven package, ignoring test parameters

Mvn-dmaven.test.failure.ignore=true Package Mvn-dmaven.test.skip=true
7. Web. XML which 'll be ignored


[WARNING] warning:selected war files include a web-inf/web.xml which would be ignored (Webxml attribute are missing from war task, or Ignorewebxml attribute is specified as ' true ')
When you compile a project with MAVEN, it appears
[WARNING] warning: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 of the form of no web.

[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 are required (or pre-existing web-inf/web.x ML if executing in update mode)

Reference: http://wenku.baidu.com/view/4fd678cd2cc58bd63186bdcd.html

MAVEN uses FAQs to organize

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.