从maven项目访问类到另一个java项目

时间:2016-03-27 22:53:36

标签: java eclipse maven

我正在研究从github“https://github.com/tomp2p/TomP2P”克隆的maven项目,然后在eclipse juno中导入它并完成所有必需的环境设置现在我想将类和方法用于我自己的java项目但是它给了我错误

My project tespeer with tompeer cloned from github

ppe.xl for testpeer -

<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>testpeer</groupId>
<artifactId>testpeer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.3</source>
<target>1.2</target>
</configuration>
</plugin>
</plugins>
</build>
<dependency>
<modelVersion>4.0.0</modelVersion>
<groupId>net.tomp2p</groupId>
<artifactId>tomp2p-parent</artifactId>
<version>5.0-Beta9-SNAPSHOT</version>
<packaging>pom</packaging>
<scope>compile</scope>
</dependency>





</project>

tompeer的pom.xml

1 个答案:

答案 0 :(得分:0)

您的项目pom.xml文件需要更改为:

<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>testpeer</groupId>
    <artifactId>testpeer</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>tomp2p.net</id>
            <url>http://tomp2p.net/dev/mvn/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>net.tomp2p</groupId>
            <artifactId>tomp2p-all</artifactId>
            <version>5.0-Beta8</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>