Today encountered a Mavan warehouse does not have a jar package, it can only add local jar package, spent a lot of time to find information, finally OK. So this record.1. For the first time, see on the internet that can be solved with Dependencies> Dependency> groupId>XxxgroupId> Artifactid>XxxArtifactid> version>Xxxversion> Scope>SystemScope> Sys
dependent third-party jar, if the lookup classpath failed, will be error, you can first useMVN Dependency:copy-dependencies-doutputdirectory=target/libcommand to export all dependent jar packages to the Target/lib directory.Second, the use of Maven-jar-plugin modified meta-inf\manifest. MF manifest fileIn the final jar of Java application, with the Unzip tool open, you can see an important manifest file MA
When you publish your project, you may have the requirement that a jar package contains your own research code, as well as a dependent library (for example, after a log4j jar package), and there are two ways to do that when MAVEN packs. 1, using the Maven-assembly-plugin plugin
The Pom.xml configuration is as follows
copy print?
Then enter on the command line:
MVN assembly:assembly
You will find the newly generated {Artifactid}-jar-with-dependencies.jar file under the ${project}/target folder.
In the execution of the above command, MAVEN exports the package that the jar package relies on, and extracts (unpackage) and puts it in the
This {Artifactid}-jar-with-dependencies
Automatically download jar packages using Maven
Right-click the project to convert the project into a MAVEN project
Then go in Maven's official website
http://mvnrepository.com/
There are a lot of jar packages for us to use, such as I'm now going to download a jsoup jar package
Search Jsoup, click the first one
Then there
Will rely on the break into the jar package, because Maven manages all the dependencies, so the project's code and dependencies into a package for it is a logical function. Maven This feature was used before, but this time forget
by us and does not need maven to go to the warehouse to find it. Specifying scope as system needs to be used with another property element, Systempath, which represents the location of the dependency on the current system, using an absolute path. For example, the website gives a tools.jar about using the JDK:Project> ... Dependencies> Dependency> groupId>Sun.jdkgroupId> Artifactid>ToolsArtif
In daily development we often need to package the project into a CLI (command line) package that can be run directly on the command lines. The default maven-generated jar package contains only the. class files and project resource files that were compiled, and a jar file that can be run directly from the command line t
Create a folder under any directory, under which you create a pom.xml file, a bat batch script;
Select the bat batch script right-click Edit and copy the following: Call Mvn-f pom.xml dependency: Copy-dependencies@Pause
Pom.xml does not need to be as complex as the actual project, the example is as follows (XML version= "1.0"?>Projectxmlns= "http://maven.apache.org/POM/4.0.0"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation=
successfully download the associated jar packageSolution:Manually import the required jar packages yourselfHere's where Spark's jar bag is.The screenshot shows:Such as:All I need is Spark's relevant jar package.The configuration information added by the configuration file Pom.xml is as follows:
Under MAVEN's library file, mine is .... \apache-maven-3.0.4\maven-depend
The following issues occur with the Maven install and package in idea today: for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 is missing, no dependency information Available[warning] Error Injecting:org.apache.maven.plugin.compiler.CompilerMojojava.lang.NoClassDefFoundError: ORG/codehaus/plexus/compiler/util/scan/mapping/suffixmapping for org.apache.maven.plugins:maven-resources-plugin:jar:2.6 is
project part of the file structure into maven. Note here that the project file structure in this way is somewhat different from the structure created by (1). So some of Maven's features aren't very well implemented.For example: Maven relies on a apklib that creates a "gen-external-apklibs" on its own initiative in a project created in (1) and puts the dependency packag
Idea Hot Deployment:by adding devtools dependencies to the 1:pom, you can implement hot deployment 2: Each time you change the Java code, you need to recompile, without restarting, you can let the changed code to take effect.Download the jar package and put it in Maven Idea is not linked to the MAVEN reposit
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. C
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. C
I. Usage scenarios1. If you want to configure use in the Maven pom file, you must add the jar package to the MAVEN repository in accordance with the MAVEN specification, and then you can configure the reference in the Pom.Two. Preparatory work1. The computer is already installed
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.