81,095
社区成员
发帖
与我相关
我的任务
分享
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.luxuanren.study</groupId>
<artifactId>study-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>study-inherit</artifactId>
<name>study-inherit</name>
<description>study-inherit</description>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.luxuanren.study</groupId>
<artifactId>study-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>../study-module-a</module>
</modules>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>study-module-a</artifactId>
<name>study-module-a</name>
<description>study-module-a</description>
<parent>
<groupId>com.luxuanren.study</groupId>
<artifactId>study-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../study-modules</relativePath>
</parent>
</project>
package com.luxuanren.study.modules;
public class ClassA {
public void print() {
System.out.println("ClassA in module A");
}
}
package com.luxuanren.study.modules;
public class Test {
public static void main(String[] args) {
// new ClassA.print();
}
}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.luxuanren.study</groupId>
<artifactId>study-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>study-inherit</artifactId>
<name>study-inherit</name>
<description>study-inherit</description>
<dependencies>
<dependency>
<groupId>com.luxuanren.study</groupId>
<artifactId>study-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.luxuanren.study</groupId>
<artifactId>study-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>../study-module-a</module>
</modules>
<dependencies>
<dependency>
<groupId>com.luxuanren.study</groupId>
<artifactId>study-module-a</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
这样可以解析到ClassA了,但是eclipse报错:Description Resource Path Location Type
Project 'study-inherit' is missing required Java project: 'study-modules'
[/quote]你用maven 就不要互相引用项目了。<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.luxuanren.study</groupId>
<artifactId>study-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>study-inherit</artifactId>
<name>study-inherit</name>
<description>study-inherit</description>
<dependencies>
<dependency>
<groupId>com.luxuanren.study</groupId>
<artifactId>study-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.luxuanren.study</groupId>
<artifactId>study-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>../study-module-a</module>
</modules>
<dependencies>
<dependency>
<groupId>com.luxuanren.study</groupId>
<artifactId>study-module-a</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
这样可以解析到ClassA了,但是eclipse报错:Description Resource Path Location Type
Project 'study-inherit' is missing required Java project: 'study-modules'