Maven package 时出现should not point at files within the project directory

实际情况是在使用jenkins自动部署maven打包时出现如下错误:

[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.jeecgframework:jeecg:war:3.8
[WARNING] 'dependencies.dependency.systemPath' for com.oracle:ojdbc14:jar should not point at files within the project directory, ${project.basedir}/src/main/webapp/WEB-INF/lib/ojdbc14-10.2.0.5.0-20170917.jar will be unresolvable by dependent projects @ line 285, column 25
[WARNING] 'dependencies.dependency.systemPath' for org.freemarker:freemarker:jar should not point at files within the project directory, ${project.basedir}/src/main/webapp/WEB-INF/lib/freemarker-null-2.3.19.jar will be unresolvable by dependent projects @ line 444, column 25
[WARNING] 'dependencies.dependency.systemPath' for org.artofsolving:jodconverter:jar should not point at files within the project directory, ${project.basedir}/src/main/webapp/WEB-INF/lib/jodconverter-3.0-beta-4-20170917.jar will be unresolvable by dependent projects @ line 474, 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] 

当然也可以将这几个jar包注册进maven,但是就是逃避问题了,而我的pom.xml上配置是这样子的:

<dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc14</artifactId>
            <version>10.2.0.5.0</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/ojdbc14-10.2.0.5.0-20170917.jar</systemPath>
        </dependency>

若想正常注册,只需要将这里的scope和systemPath删掉,如

<dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc14</artifactId>
            <version>10.2.0.5.0</version>
        </dependency>

然后在build节点里增加maven-install-plugin的plugin ,如下所示:

<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-install-plugin</artifactId>
				<version>2.5.2</version>
				<executions>
					
					<execution>
						<id>install-ojdbc14</id>
						<phase>clean</phase>
						<configuration>
							<file>${project.basedir}/src/main/webapp/WEB-INF/lib/ojdbc14-10.2.0.5.0-20170917.jar</file>
							<repositoryLayout>default</repositoryLayout>
							<groupId>com.oracle</groupId>
							<artifactId>ojdbc14</artifactId>
							<version>10.2.0.5.0</version>
							<packaging>jar</packaging>
							<generatePom>true</generatePom>
						</configuration>
						<goals>
							<goal>install-file</goal>
						</goals>
					</execution>
					
					<execution>
						<id>install-freemarker</id>
						<phase>clean</phase>
						<configuration>
							<file>${project.basedir}/src/main/webapp/WEB-INF/lib/freemarker-null-2.3.19.jar</file>
							<repositoryLayout>default</repositoryLayout>
							<groupId>org.freemarker</groupId>
							<artifactId>freemarker</artifactId>
							<version>2.3.19</version>
							<packaging>jar</packaging>
							<generatePom>true</generatePom>
						</configuration>
						<goals>
							<goal>install-file</goal>
						</goals>
					</execution>
					
					<execution>
						<id>install-org.artofsolving</id>
						<phase>clean</phase>
						<configuration>
							<file>${project.basedir}/src/main/webapp/WEB-INF/lib/jodconverter-3.0-beta-4-20170917.jar</file>
							<repositoryLayout>default</repositoryLayout>
							<groupId>org.artofsolving</groupId>
							<artifactId>jodconverter</artifactId>
							<version>3.0-beta-4</version>
							<packaging>jar</packaging>
							<generatePom>true</generatePom>
						</configuration>
						<goals>
							<goal>install-file</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

然后运行打包命令即可正常打包

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值