myEclipse ordinary project to Maven

1. The old project ueditor, it is the engineering method of the lib package

2. I wanted to use myEclipse's own function to add Maven capabilities to the project, but found that it was not easy to use, so I decided to make a trick and directly copy a pom file to the project

3. Modify the pom file and change everything in the original lib package to maven reference

Specific steps: Go to the private server to find the corresponding dependency


Here's a brief look at pom.xml



4. Right-click to delete the old project first, but do not delete the project

5. Re-import as maven project



At this time, the right-click of the project becomes the maven project


As shown above, updateProject forcefully pulls the dependencies in the pom file, [that is, to download the jar file, the path is the private server address specified in the pom file just now]

At this point or release more maven dependencies are in the project


It will be downloaded and placed in my local warehouse, as shown in the path in the above figure, so that the old lib folder can be deleted. At this time, the project will usually report an error. Right-click the build path and delete the missing package.

The work at this point is a completed maven project

=============== The work at this time is a completed maven project ===================

If the project is packaged into a private server:


Run the mvn command on MyEclipse, right-click the project and select Run As--"Maven clean. There are many mvn commands, and the more commonly used commands are briefly described below:

1. clean is used to clean up the output directory target/

2. compile is used to compile the main code of the project 

3. test is used to compile and run the test code

4. package accepts compiled code and packages it into a releasable mode

5. install installs the package to the maven local repository

6. Deploy copies the final package to the remote repository

When the above command is executed, clean will not be executed automatically, because clean and the other five commands have different life cycles, so a combined command needs to be used.

Such as the following command: clean deploy


Now log in to the private server and you can see the jar package you uploaded


If other projects need this jar package, you only need to copy the rightmost one, import this project, and then execute mavan's update Project to force the dependency to be pulled. To see if it has been pulled down, just look at the dependencies of the project below. Whether the imported jar package has been down is ok

quite complete,

But I have planned to change the intelliJ IDE! ! It's a perfect ending

Guess you like

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