首页 > 解决方案 > 如何从同一父级中的另一个服务访问包

问题描述

我创建了 5 个微服务,它们在 pom.xml 中都有相同的父级。我正在尝试将一个包从一个子服务访问core-service到另一个子服务data-processor

下面是我data-processor试图com.itqe.tdm.core.model.Customercore-service

package com.itqe.dataprocessor.util;

import org.springframework.batch.item.excel.RowMapper;
import org.springframework.batch.item.excel.support.rowset.RowSet;
import org.springframework.stereotype.Component;

import com.itqe.tdm.core.model.Customer;

@Component
public class RowMapperImpl implements RowMapper<Customer> {

    @Override
    public Customer mapRow(RowSet rs) throws Exception {
        if (rs == null || rs.getCurrentRow() == null) {
            return null;
        }
        Customer cust = new Customer();
        cust.setFirstName(rs.getColumnValue(0));
        cust.setLastName(rs.getColumnValue(1));

        return cust;
    }



}

当我尝试构建代码mvn clean install时,出现以下错误

package com.itqe.tdm.core.model does not exist

我已经mvn install在父服务以及core-service. 罐子出现在我的 m2 中。我在 pom 中添加了依赖项data-processor

<dependency>
    <groupId>com.itqe</groupId>
    <artifactId>core-service</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>

有人可以帮我理解我在这里缺少什么吗?感谢帮助。

父 pom.xml

<modules>
        <module>config-server</module>
        <module>registry-service</module>
        <module>gateway-service</module>
        <module>core-service</module>
        <module>data-processor</module>
    </modules>

标签: springspring-boot

解决方案


推荐阅读