發表文章

目前顯示的是有「Maven」標籤的文章

Maven file transfer failure

When using maven to get dependencies, files are required to download from respository. In some situation, file transfer may be failure. The following exception will be encountered:   Description Resource Path Location Type Could not calculate build plan: Failure to transfer xxxxxx:pom:xx.xx.xx from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact xxxxxxx:xxxx:pom:xx.xx.xx from/to central ( http://repo1.maven.org/maven2 ):                                                                  ...

Deployment problem casued maven auto generated application.xml

When you encounter  exception like the following Target state: deploy failed on Cluster CmsappsvCorpBrsmainPrd java.io.FileNotFoundException: File not found The application.xml in your ear maybe stating a wrong war or jar file. This is caused by the application.xml that generated by maven automatically. Please remove to remove this application.xml before building ear file.

Executable jar with onejar-maven-plugin

Onejar-maven-plugin collects your application including dependencies, into one executable jar. It's both easy and works well! Problem If you have ever tried doing this before with Maven, you have probably used maven-assembly-plugin , which would leave the door open for classpath problems! It would extract all your dependency jars in one directory together with all your class files and all other classpath resources. The problem is that everything ended up in a big mix, with classpath resources possibly overwriting each other. For example, if two dependencies each had a log4j.properties file in their jar, one log4j.properties would overwrite the other. No more of that mess! Solution Enter maven-onejar-plugin. It lets all your dependency jars stay jars, and your code is in its own jar. All of those jars are put in a bigger jar, which is made executable. Configuration It may sound weird, but it's quite elegant! Just put this in your pom.xml 's tag to make it wo...

Rebuild maven local repository index after updated the library

圖片
Please remember to rebuild the maven local repository index after your library is being updated. For example, common library that are developing.