When using Eclipse to write programs, there will always be some puzzling problems, such as a message indicating that a certain class or method is not found, or saying that there is a syntax error when there is no syntax error, which can be easily solved by using Project Clean.
However, if your project is compiled using Maven, there is also a Maven clean. What is the difference between the two? I did some experiments with a specific project, tracing the target folder in the project directory and drawing the following conclusion:
maven clean
Maven clean is a clean life cycle for Maven. The purpose is to remove the build output from the build directory. (You can also say everything after removing Maven Install).
The project clean:
Project clean is the IDE’s deletion of the classes folder in the Target directory. (You can also remove everything that the IDE automatically compiles).
Read more about Maven multi-repository configuration
Maven’s central repository is powerful and contains most jars. But there are some that aren’t included. An error is reported when an unincluded JAR is encountered.
In addition to the official repository provided by Maven, there are also many repositories. As much as possible, make trusted warehouses (well, trusted warehouses!) Add a few to make up for the lack of maven’s official repository.
Multi-warehouse configuration mode 1: Global multi-warehouse configuration
The global multi-repository setup is implemented by modifying Maven’s setting file. Add multiple profiles to the setting file (you can also include multiple repositories in a profile) and activate the profile (even if only one profile is available).
Modify maven’s setting file to set two repositories (and so on, you can add more) :
<profiles> <profile> <! -- Id must be unique --> <id>myRepository1</ ID > <repository> <! -- id must be unique --> <id>myRepository1_1</id> <! - the url address of the warehouse - > < url > http://maven.aliyun.com/nexus/content/groups/public/ < / url >; <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> </repositories> </profile> <profile> <! -- Id must be unique --> <id>myRepository2</ ID > <repository> <! -- id must be unique --> <id>myRepository2_1</id> <! - the url address of the warehouse - > < url > http://repository.jboss.org/nexus/content/groups/public-jboss/ < / url >; <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> </repositories> </profile> </profiles> <activeProfiles> <! MyRepository1 --> <activeProfile>myRepository1</activeProfile> <! -- Activate myRepository2 --> <activeProfile>myRepository2</activeProfile> </activeProfiles>Copy the code
Multiple warehouses Configuration method 2: Add multiple warehouses to the project
Adding multiple repositories to a project is done by modifying poM files in the project.
Add multiple Repository nodes under the REPOSITORY node of the POM file in the project (if not manually added).
Modify the POM file in the project to set up two repositories (and so on, you can add more) :
<repositories> <repository> <! <id>jboss-repository</id> <! <name>jboss repository</name> <! - the url address of the warehouse - > < url > http://repository.jboss.org/nexus/content/groups/public-jboss/ < / url >; </repository> <repository> <! -- id must be unique --> <id>aliyun-repository</id> <! <name> Repository </name> <! - the url address of the warehouse - > < url > http://maven.aliyun.com/nexus/content/groups/public/ < / url >; </repository> </repositories>Copy the code
Note: The ID value of the above two methods cannot be regarded as “central”.