maven依赖项在导入时不可见

huangapple go评论79阅读模式
英文:

maven dependency not visible for importing

问题

在我的多模块项目中,其中一个模块中包含了依赖项,有些是可见的,而其他一些则不可见。我尝试更好地解释:

在父POM中,我有这个模块:

<modules>
    <module>DataModelIbm</module>
    <module>commonResources</module>
    <module>wsdlClient</module>
    <module>utente</module>
</modules>

在模块utente的POM中,我有:

<dependency>
    <groupId>dc.ita.int.gu</groupId>
    <artifactId>DataModelIbm</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>dc.ita.int.gu</groupId>
    <artifactId>commonResources</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>dc.ita.int.gu.wes</groupId>
    <artifactId>wsdlClient</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>

在Utenti项目中,我导入了以下内容:

从DataModelIbm模块:

import dc.ita.int.gu.database.model.GuUserCon;
import dc.ita.int.gu.database.model.GuUserNon;

从commonResources模块:

import dc.ita.int.gu.errorhandler.ErrDetails;

从wsdlClient模块:

import dc.ita.int.gu.wes.websso.wsdl.CreateUserResponse;
import dc.ita.int.gu.wes.websso.wsdl.GetUser;

但是,当我尝试编译时,只有从wsdlClient导入的类出现错误。可能的原因是什么?是Maven的问题吗?

英文:

i have a multimodule project and in one of this module I include dependency, some are visibile the other not; try to explain better:

i have this module in parent pom:

	&lt;modules&gt;
		&lt;module&gt;DataModelIbm&lt;/module&gt;
		&lt;module&gt;commonResources&lt;/module&gt;
    	&lt;module&gt;wsdlClient&lt;/module&gt;
		&lt;module&gt;utente&lt;/module&gt;
  &lt;/modules&gt;

in the pom of the module utente I have:

  &lt;dependency&gt;
    	&lt;groupId&gt;dc.ita.int.gu&lt;/groupId&gt;
    	&lt;artifactId&gt;DataModelIbm&lt;/artifactId&gt;
    	&lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
    	&lt;groupId&gt;dc.ita.int.gu&lt;/groupId&gt;
    	&lt;artifactId&gt;commonResources&lt;/artifactId&gt;
    	&lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
    	&lt;groupId&gt;dc.ita.int.gu.wes&lt;/groupId&gt;
  		&lt;artifactId&gt;wsdlClient&lt;/artifactId&gt;
  		&lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
     &lt;/dependency&gt;

In the project of Utenti, I import:

from module DataModelIbm

import dc.ita.int.gu.database.model.GuUserCon;
import dc.ita.int.gu.database.model.GuUserNon;

from commonResources:

import dc.ita.int.gu.errorhandler.ErrDetails;

from wsdlClient

import dc.ita.int.gu.wes.websso.wsdl.CreateUserResponse;
import dc.ita.int.gu.wes.websso.wsdl.GetUser;

But when I try to compile there is error only on the class imported from wsdlClient;

What can be the reason, is maven bug???

答案1

得分: 1

我认为这是构建模块时使用的顺序的问题。

链接:https://stackoverflow.com/questions/11131575/build-order-of-maven-multimodule-project

英文:

I think it is an issue with the order used to build the modules

https://stackoverflow.com/questions/11131575/build-order-of-maven-multimodule-
project

答案2

得分: 1

不,这听起来不像是Maven的bug。作为一个起点,在utente模块中打开一个命令shell,并运行mvn dependency:tree来检查您的依赖项,确保您正确导入了wsdlClient模块。另外,由于与wsdl相关的代码通常是自动生成的,请检查源代码,确保类的可见性表达式、包等方面都正确无误。很不幸,没有看到错误消息,通过这个清单进行检查是可以提供的最有帮助的。

英文:

No, it doesn't sound like a Maven bug. As a starting point, open a command shell in the utente module and run mvn dependency:tree to check your dependencies to make sure that you are importing the wsdlClient module properly. Also, since wsdl-related code is often autogenerated, check the source code to make sure that everything is proper with class visibility expressions, packages, etc. Without seeing the error message, going through this checklist is the most help that can be given unfortunately.

huangapple
  • 本文由 发表于 2020年8月8日 07:22:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/63310286.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定