我已将外部 jar 部署到本地 Nexus 存储库。我已经在setting.xml中定义了存储库,并在POM.xml中提供了依赖项。
我的项目能够下载 Maven 依赖项中的 jar,但是当我尝试从该 jar 导入任何类时。
我无法导入它。它说无法解析为类型
。
所以简而言之,我无法使用从本地 nexus 存储库下载的 jar 中的类。
有人可以帮我吗?
这是我的Setting.xml 文件的存储库部分
<profiles>
<profile>
<id>myprofile</id>
<repositories>
<repository>
<id>modelhelper-repo</id>
<name>Modelhelper repository</name>
<url>http://localhost:8081/#browse/browse:maven-public </url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
我的个人资料
这是 pom.xml 文件的依赖项:
<dependency>
<groupId>com.ravina</groupId>
<artifactId>modelhelper</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
这个 modelhelper-1.0.0.jar
中有 Employee 和其他许多类,我无法将其导入到我的项目中。
最佳答案
settings.xml 中的存储库 URL 似乎不正确 - 看起来您使用了浏览器中的 URL。您应该使用的 URL 是 http://localhost:8081/repository/maven-public/
存储库 URL 可以在管理 -> 存储库 -> [repository_name] 中找到
关于java - 无法从自定义 Maven Nexus 存储库下载的 jar 导入类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54038992/