<dependency> <groupId>patchca</groupId> <artifactId>patchca</artifactId> <version>0.5.0</version> <scope>system</scope> <systemPath>${pom.basedir}/src/main/webapp/WEB-INF/lib/patchca-0.5.0.jar</systemPath> </dependency>
这样就省去了将jar包安装到本地maven仓库的麻烦~只要保证需要用的jar包在lib下面就可以了。
这么做的目的是为了使用mvn:compile去编译项目,有些开发工具会在代码被修改后自动编译,因为在ide的环境中web项目的lib目录可能已经被添加为了classpath,但是在maven执行编译的时候,这个lib目录下的jar包是不会自动加入到classpath的,这里使用的不是加入classpath的方式,而是直接用maven指定jar文件的方式,更加方面,可移植性更高。
注意,这里使用的是pom.basedir而不直接写basedir就是为了在执行maven命令的时候,避免因为manve引入了项目中的jar发出类似于下面的警告。
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.fengyunhe:sptemplate:war:1.0-SNAPSHOT
[WARNING] ‘dependencies.dependency.systemPath’ for patchca:patchca:jar should not point at files within the project directory, ${basedir}/src/main/webapp/WEB-INF/lib/patchca-0.5.0.jar will be unresolvable by dependent projects @ line 356, column 25
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
了解 工作生活心情记忆 的更多信息
订阅后即可通过电子邮件收到最新文章。