The use of maven in eclipse

1. Export to the default directory targeted/dependency
  Export the jar package that the project depends on from the Maven project: enter the directory where the project pom.xml is located, and execute the following command:
  1. mvn dependency:copy-dependencies or in eclipse, select the project's pom.xml file, click Run As in the right-click menu, see the red box in the figure below, in the pop-up Configuration window, enter dependency:copy-dependencies, click Run;
  2. The jar package that the maven project depends on will be exported to in the targeted/dependency directory.
  2. Export to a custom directory
  Create a lib folder under the maven project and enter the following command:
  1. mvn dependency:copy-dependencies -DoutputDirectory=lib;
  2. The jar packages that the maven project depends on will be copied to the project directory lib directory.
  3. Set the dependency level
  At the same time, you can set the dependency level, usually use the compile level
  mvn dependency:copy-dependencies -DoutputDirectory=lib -DincludeScope=compile

 

 

 


When compiling with maven under Eclipse/MyEclipse , it fails, prompting:

Please ensure you are using JDK 1.4 or above and not a JRE (the com.sun.tools.javac.Main class is required). 

Cause of the problem:
Eclipse/MyEclipse defaults to It is to use jre as the running environment, and maven compilation requires jdk as the running environment;

solution:
set jre under JDK as the JRE system library required for the Maven project to run;

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326427538&siteId=291194637