[英]Import and run a maven project in Eclipse IDE
我想在Eclipse中導入現有的maven項目,但是我不確定如何使一切正常運行。 項目結構如下:
一個主要目錄,其中包含pom.xml
和5個子文件夾/子項目,每個子目錄中都有一個pom.xml
。
我搜索了一些與此相關的帖子,並提出了以下步驟:
在我的項目瀏覽器中,我現在有一個工作集,其中包括所有子項目作為簡單文件夾。 而且,現在所有子文件夾都單獨列出了,應該嗎? 最重要的是,在這些子項目中,路徑是重復的(請參見屏幕截圖),即我有一個src> main> java多合一目錄,然后是一個常規的src> main> java路徑。 這是為什么?
現在我想知道這些步驟是否正確,以及如何運行特定子項目的代碼? 我還必須單獨構建這些文件還是僅構建工作區就足夠了?
主目錄的pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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>br.com.uniriotec</groupId>
<artifactId>NlgFramework</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>Machine-Artifact</module>
<module>General-Language-Common</module>
<module>Portuguese-Realizer</module>
<module>English-Realizer</module>
<module>BPM2NLG</module>
</modules>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</project>
右鍵單擊您的項目,然后查找maven->更新項目,這應該可以工作。
雖然您的結構看起來很奇怪。 您可以將子項目自己作為自己的項目簽出,然后用maven逐個編譯它們
By looking at the screen shot i think there is only one project, having multiple source file organised in multiple packages.
Please share your project over git or may be your pom file so that we can help you here.
Note - I think you were using maven eclipse:eclipse plugin which is used to generate eclipse .project and .classfile which is a metdata file about project and used by eclipse.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.