实际情况是在使用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>

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

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐