[英]Changes in dependent modules cannot be seen in other module in Maven Eclipse
我正在使用m2eclipse进行多模块项目。 我设置Maven来解决工作区依赖性。 但是,当我在服务模块上进行更改时,更改不会立即在其他模块上可见。 如果我在Service层中创建新方法,则该方法在WebApp层中不可见。 有时,甚至“运行/ maven”安装和刷新以及“ 项目/清理”和“ Maven /更新依赖项”也无法正常工作。 有人可以给我一个关于这个问题的想法吗?
我的项目结构如下所示:
父模块
<groupId>com.myproject</groupId>
<artifactId>einvites-parent</artifactId>
<modules>
<module>myproject-common</module>
<module>myproject-domain</module>
<module>myproject-service</module>
<module>myproject-web</module>
</modules>
服务模块
<parent>
<artifactId>myproject-parent</artifactId>
<groupId>com.myproject</groupId>
<version>1.0</version>
</parent>
<groupId>com.myproject</groupId>
<artifactId>myproject-service</artifactId>
网络模块
<parent>
<artifactId>myproject-parent</artifactId>
<groupId>com.myproject</groupId>
<version>1.0</version>
</parent>
<groupId>com.myproject</groupId>
<artifactId>myproject-web</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>myproject-web</name>
<dependencies>
<dependency>
<groupId>com.myproject</groupId>
<artifactId>myproject-service</artifactId>
<version>1.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
这应该工作; 对我有用。 我真的不确定这是否可以解决问题,但是可以尝试将POM更改为使用SNAPSHOT
版本,例如1.0-SNAPSHOT
(无论如何,对于活跃开发中的模块,您都应该使用SNAPSHOT
版本)。
顺便说一下,您的POM中有很多不必要和多余的东西。 它们应如下所示:
服务模块
<project>
...
<parent>
<artifactId>myproject-parent</artifactId>
<groupId>com.myproject</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<!--groupId>com.myproject</groupId--> <!-- no need, you inherit it -->
<artifactId>myproject-service</artifactId>
...
</project>
网络模块
<project>
...
<parent>
<artifactId>myproject-parent</artifactId>
<groupId>com.myproject</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<!--groupId>com.myproject</groupId--> <!-- no need, you inherit it -->
<artifactId>myproject-web</artifactId>
<!--version>1.0</version--> <!-- no need, you inherit it -->
<packaging>war</packaging>
<name>myproject-web</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId> <!-- use the built-in properties instead -->
<artifactId>myproject-service</artifactId>
<version>${project.version}</version> <!-- use the built-in properties instead -->
<!--type>jar</type--> <!-- no need, that's the default -->
<!--scope>compile</scope--> <!-- no need, that's the default -->
</dependency>
</dependencies>
...
</project>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.