Dependent mediation:Project A has such a dependency: X (1.0), C, A, B, a, D, and X (2.0)X is a transitive dependency, but there are two versions of X on two dependent paths, which x will be used by MAVEN parsing?It is not right to resolve two versions because that would cause dependency duplication, so you must choose
Eclipse Libraries does not have a dependency package for MAVEN, follow the steps below1. Project Right-click-"Build Path-"Java Build Path-"Libraries-"Add Library-" Maven Managed dependences-click Next-click on ' Maven Project settings ' and add in ' Active Maven Profiles (co
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,
We often encounter such problems when using MAVEN to compile a project.Could not get the value for parameter encoding for plugin execution default-resourcesPluginorg.Apache.maven.Plugins:maven-Resources-plugin:2.6Or one of its dependencies could isn't be resolved: FailureTo find org.Codehaus.plexus:plexus-Utils:Jar:1.1In http://nexusserver:8081/nexus/content/groups/public/was cached in the local repository, resolution won't be reattempte D until the u
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\
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
First look at the configuration maven relies onOfgroupId,artifactid , and version: the basic coordinates of dependency (coordinates are not descriptive, and all know)Type: The default value is the jar (known to be available). Very little to ignore)Scope: The range of dependencies (this is important. The following continue to speak)Optional: Whether tag dependency
Artifactid>Maven-jar-pluginArtifactid>4 Configuration>5 Archive>6 Manifest>7 MainClass>Ctas.importer.reader.app.ProgramMainClass>8 Addclasspath>TrueAddclasspath>9 Classpathprefix>lib/Classpathprefix>Ten Manifest> One Archive> A classesdirectory> - classesdirectory> - Configuration> the plugin>Line 7th specifies Main-class, and line 9th
Let's look at one of the most common examples:
This example shows that your project has a junit dependency. You might ask: Where does this dependency come from? Where is the JUnit jar?
A dependency is a reference to a artifact in the repository. The Pom defines a dependency, which is executed by the
By right-clicking the pom.xml file to select Maven–> add dependency or by opening the Pom.xml file, when you select Dependencies–>add, you cannot search for the dependent jar package, the workaround is as follows:1. Eclipse Menu window-> Show view–> other–> Maven2, in the open window, right-click Local repositories–> local repository, select Rebuild IndexAdd:1. Confirm that the Pom.xml file is correct2, con
By right-clicking the pom.xml file to select Maven–> add dependency or by opening the Pom.xml file, when you select Dependencies–>add, you cannot search for the dependent jar package, the workaround is as follows:1. Eclipse Menu window-> Show view–> other–> Maven2, in the open window, right-click Local repositories–> local repository, select Rebuild IndexAdd:1. Confirm that the Pom.xml file is correct2, con
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
In pom4, the scope element is introduced into the dependency element, which is a very important attribute. In Maven projects, jar package conflicts and type conversion exceptions are caused by improper use of scope elements.The role of the scope element: controls the scope of use of the dependency element. In general, it is to control the scope in which jar packa
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
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
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.
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>
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
-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
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.