gpt4 book ai didi

java - 在 Maven 中将本地 Jar 添加到父模块

转载 作者:行者123 更新时间:2023-12-01 18:59:22 26 4
gpt4 key购买 nike

My Parent Module is building fine but jars from /lib folder in Parent Project are not getting copied to .m2 directory. No jar file "sqljdbc" is generated from mentioned dependency; See below parent.pom.xml file

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>common</groupId>
<artifactId>common-parent</artifactId>

<version>0.0.1-SNAPSHOT</version>
<name>common-parent</name>
<packaging>pom</packaging>
<description>It's a Parent Project for Child Projects</description>

<repositories>
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/lib</url>
</repository>
</repositories>
<build>
<finalName>common-parent</finalName>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>microsoft</groupId>
<artifactId>sqljdbc</artifactId>
<version>4</version>
</dependency>
</dependencies>
</dependencyManagement>
<modules>
<module>../FirstChild</module>
</modules>

</project>

Let me know if i am missing someting. Further i am following https://dzone.com/articles/maven-multi-module-project-with-versioning To generate modules

最佳答案

您将文件添加为依赖项,而不是在磁盘上添加带有路径的存储库,我不知道这是否有效,但确实如此。

<dependency>
<groupId>microsoft</groupId>
<artifactId>sqljdbc</artifactId>
<version>4</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/name.jar</systemPath>
</dependency>

关于java - 在 Maven 中将本地 Jar 添加到父模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59650300/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com