Maven notes: The package path confusion problem when maven creates an archetype

When using mvn archetype:create-from-project to create a code project template, ${package} will appear in the import position of the code template , and sometimes there may be a "disorder" situation, such as org.apache .log4j , which will be replaced by net .pgia.info .log4j .

 

A relatively clumsy way is to manually modify the automatically generated code template, and change the messy package path ${package} back, but it will obviously be very troublesome, and this disorder will occur when regenerating, every time you need to Manual modification.

 

What is the reason for this? After some exploration, it is found that maven will automatically replace the placeholder according to the prefix of your original project (the code project used to generate the archetype ). For example, the package structure of your original project is org.task , then you will see To all org.*** will be replaced with ${package} . . .

 

Therefore, the fundamental solution is to modify the packge structure of the original project , such as changing to com.task , etc.

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326859997&siteId=291194637