简体   繁体   English

如何使用 maven spring 将项目 A 的依赖(方法)包含到项目 B 中

[英]How to include dependency (method) of project A into project B using maven spring

I have a Spring boot application, My Project A(crux) has a Log generator class which I want to use in project B(bolt).我有一个 Spring 启动应用程序,我的项目 A(crux) 有一个日志生成器类,我想在项目 B(bolt) 中使用它。 I have included project A in the pom.xml of Project B but still its not able to find that.我已经在项目 B 的 pom.xml 中包含了项目 A,但仍然无法找到。 package : com.test.sre.crux & class : MyLogger.withField() in project B包:com.test.sre.crux & 类:项目 B 中的 MyLogger.withField()

pom.xml of B(bolt) B(bolt)的pom.xml

        <dependency>
            <groupId>com.test.sre.crux</groupId>
            <artifactId>Crux</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
INFO] Scanning for projects...
[INFO] 
[INFO] -------------------------< com.apple.sre:bolt >-------------------------
[INFO] Building Bolt 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.test.sre.crux:Crux:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

pom.xml of A(crux) A(症结)的pom.xml

    <groupId>com.test.sre</groupId>
    <artifactId>crux</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>crux</name>
    <description>Repo for all the key metrics and usabilities</description>

I have also tried to include build path, please suggest.我也尝试过包含构建路径,请提出建议。 在此处输入图片说明

The group id and artifact id should be the same in both poms两个 poms 中的组 ID 和工件 ID 应该相同

<groupId>com.test.sre</groupId>
<artifactId>crux</artifactId>

Then, make sure you do a mvn install, so you have project A in your local maven repository.然后,确保您执行了 mvn 安装,以便您在本地 maven 存储库中有项目 A。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM