The role of scope in the Maven dependency relationshipDependency Scope* Compile, default, applies to all stages and will be published along with the project.* provided, similar to compile, expects the JDK, container or user to provide this dependency. such as Servlet.jar.* Runtime, used only at runtime, such as JDBC driver, for run and test phases.* Test, used on
Original article: http://peak.iteye.com/blog/299225
Role of scope in Maven dependency
Dependency Scope
In pom 4,
* Compile, default value, applicable to all stages and will be released along with the project.* Provided, similar to compile, expects JDK, container, or user to provide this dependency. For example,
Recently, using the Maven plugin on idea, when Pom.xml wrote a project-dependent jar package, it was downloaded to the local jar, unable to auto-complete, and needed to be written manually. affect efficiency very much.For this problem, you can manually update the jar index of the local repository in MAVEN setting to resolve it. As followsFile-To-setting-->maven--
Problem: Maven relies on jar export disappearing problemThe new innovative Maven managed project, using the template is Maven-archetype-quickstart, set maven managed jar export when the followingEach time "Update projects" is automatically added to Maven dependencies, the re
Reprint: http://xyly624.blog.51cto.com/842520/865630/The dependency package to be referenced by HttpServletRequest or httpservletresponse under the MAVEN project: Servlet-api.jar, and set scope to provided.Pom.xml:
dependency>
groupId>javax.servletgroupId>
artifactid>servlet-apiartifactid>
version>2.5version>
scope>providedscope>
Add to Pom.xmlPackage Command: MVN assembly:assembly, after successful execution, a jar package with-jar-with-dependencies end is added to the target folder. This jar package contains the class of all the jars on which the project depends.3. If you do not want the dependent jar package to become class, you can modify the assembly plugin.3.1 Found assembly address in local, generally c:/users/${your_login_name}/.m2/\org\apache\maven\plugins\
-dfile= Ojdbc7.jarThen it's still a mistake.Later I found the cause of the error because I was under windows and I ran this section of the program on the GIT command line that was opened.Open the Windows command-line interface, enter the ~/additional_jars/directory, and then run:MVN install:install-file-dgroupid=com.oracle-dartifactid=ojdbc7-dversion=12.1.0.2-dpackaging=jar-dfile= Ojdbc7.jarShow "BUILD SUCCESS".You can then add dependency to the
My project's build path in the library has MAVEN Dependences, which has a red fork, which shows that there are two jar packages found, the path shown is the C drive. m2 file, but these two jar packages are special,
Because I put them in the project Web-inf under the LIB, is external dependence, not in the C disk;
Then I use the MAVEN command clean install, or directly clean, all error, is not found a jar
Dependency Scope* Compile, default, applies to all stages and will be published along with the project.* provided, similar to compile, expects the JDK, container or user to provide this dependency. such as Servlet.jar.* Runtime, used only at runtime, such as JDBC driver, for run and test phases.* Test, used only during testing, to compile and run the test code. Will not be published with the project.* Syste
Reprinted from Http://www.cnblogs.com/yqskj/archive/2013/05/27/3101934.htmlThe result of using json-lib,mvnrepository.com to find its dependency in the project is as follows:XML codeHowever, when the install is always said to find the jar, so on http://json-lib.sourceforge.net/ready to download the jar package to install themselves on the repository, At this time found a little problem on the Mvnrepository, Json-lib provides two JDK version of the imp
Some jar packages are not available in the MAVEN Central Library, so how do you use them in your project? Suppose we need to use: Apache-ant-zip-2.3.jar Place the jar package in the project's Lib directory, for example: Add a reference to the jar inside the Pom.xml, for example: This will allow you to use Apache-ant-zip-2.3.jar in your project! Here's the question of how to include Apache-ant-zip-2.3.jar in a project when it's packaged into a war.
When integrating Struts2+spring+hibernate with Maven today, it is reported that as long as the spring-web dependency is not declared in the Web module, it is java.lang.NoClassDefFoundError: [lorg/ Springframework/context/applicationcontextinitializer; exception, site cannot start.Compared to a half-day discovery add spring-web dependencies after packaging generated files less a Spring-asm-3.0.5.release.jar
Create a MAVEN project with the following structure:
Among them, the contents of Pom.xml are as follows:
Application.properties File Contents:
Jdbc.driverclassname=${jdbc.driverclassname}
Jdbc.url=${jdbc.url}
Jdbc.username=${jdbc.username}
Jdbc.password=${jdbc.password}
Profile-dev.properties File Contents:
Jdbc.driverclassname=com.mysql.jdbc.driver
jdbc.url=jdbc:mysql:///db_users
jdbc.username=root
Jdbc.password=root
Start the applicati
Transferred from: http://blog.csdn.net/cskgnt/article/details/8602802Workaround: Add the following pluginmanagement before plugins, both before and after the following sequence: Maven-dependency-plugin (Goals "Copy-dependencies", "unpack") is isn't supported by m2e
Solution: add the following pluginmanagement before plugins. The order of the two is as follows:
Maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e
Background:Environment problems, positioning as dependent jar missing, modify the project Pom file to supplement the dependent jar.Update Key Description:Dependency jar, Update commitBusiness jar, also need to update the commit: Maven build will reference the dependent jar, update the environment if the dependent jar package is updated separately, the new build business Jar Internal API is not consistent, the business jar also has to be updatedCases:I
Using multiple versions of a jar package in Maven can be a dependency problem, and the way to solve the problem is toUse the jar package version to exclude, such as Dubbo using Netty 4.0. Version 33 can exclude DubboNetty dependencies so that other jar packages are not referenced to the netty4.0.33 version.As follows:Related connectionshttp://chwshuang.iteye.com/blog/2069937Maven multiple Jar package versio
The Spring cloud project is typically a parent project with more than one child service, which is the Submodule module.Such as:problem Description: A common jar package is referenced in the parent project, for example, the spring boot dependency is introduced, then the introduction of the jar package in the subproject does not specify version, so the downloaded jar package is unknownAnalyze the problem:Because the jars used in the subproject are all s
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.