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

编程入门 行业动态 更新时间:2024-10-23 11:23:04

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

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

更多推荐

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

本文发布于:2023-06-14 08:49:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1458540.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:point   package   Maven   directory   project

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!