我的 STS 上有一个 java-maven 项目。问题是我想创建自己的 spring-boot 启动器并将其作为 Maven 依赖项包含在我的项目的 pom.xml 文件中。问题是这个启动器将位于内部源存储库中,我不知道需要在 pom.xml 文件中放入哪些信息才能引用内部源中的该信息而不是其他信息。也许可以指定存储库的 URL 或者什么?
非常感谢您的帮助!
最佳答案
The thing is that I want to create my own spring-boot starter and include it as a maven dependency in the pom.xml file of my project.
通过阅读本文,我认为您正在寻找的是如何创建依赖项,以便您可以轻松地将其包含在任何项目中。
通过此,您可以拥有本地 Maven 存储库或将其推送到远程存储库(就像大多数依赖项一样),重要的是无论您将其推送到何处,都可以下载。
如果您使用本地版本,您可以使用 maven/gradle 插件来打包您的 jar 并发布它。您需要指定一些属性,例如 groupId、artifactId 和 version
https://docs.gradle.org/current/userguide/publishing_maven.html
使用 groupId、artifactId 和版本,您将能够将其包含在您的项目中,例如
<dependency>
<groupId>org.myorg</groupId>
<artifactId>my-artifact</artifactId>
<version>0.0.1</version>
</dependency>
如果这是来自 Maven 本地依赖项,请不要忘记将 Maven 本地包含为存储库的一部分。
https://www.baeldung.com/maven-local-repository
查看这些文章,会对您有所帮助。
https://maven.apache.org/guides/introduction/introduction-to-repositories.html
关于java - 如何从innersource引用一个项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57321377/