2014-01-21 43 views
0

此處的文檔(http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html)告訴我應該在target/classes目錄中看到文件後過濾。當我運行compilepackage時,在任何情況下都不會有在target目錄中生成的classes目錄,因此在那個不存在的目錄中沒有文件。 (我認爲它們可能在compile期間被創建,但隨後作爲package的副產品被刪除。)Maven不保存目標/類目錄中的任何文件

這是我的目錄結構。我有一個主pom.xml爲父母和幾個子模塊與他們自己的pom.xml文件,每個模塊下的src dirs。

mexp/ 
    mexp-model/ 
    src/main/java/com/pronto/… 
    pom.xml 

    mexp-services/ 
    src/main/java/com/pronto/… 
    pom.xml 

    mexp-webapp/ 
    src/ 
     main/ 
     java/ 
      com/ 
      pronto/ 
       mexp/ 
       action/ 
        LoginFormAction.java 
    pom.xml 

    pom.xml 

這裏是我的根pom.xml中build部分:

<build> 
    <resources> 
     <resource> 
      <directory>src/main/resources</directory> 
      <filtering>true</filtering> 
     </resource> 
    </resources> 
    <filters> 
     <filter>${profile.directory}/${env}/tokens.properties</filter> 
    </filters> 
    <plugins> 
     <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.3</version> 
      <configuration> 
       <source>${java.version}</source> 
       <target>${java.version}</target> 
       <compilerArgument>-g</compilerArgument> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

FWIW,我使用Maven 3.1.1和Java 1.6.0_65,11.1.5的IntelliJ。

我想調試過濾,所以我真的想看到這些結果文件。任何幫助,將不勝感激。謝謝。

編輯:我已將此添加到我的mexp-的webapp/pom.xml中:

<plugins> 
    <plugin> 
     <artifactId>maven-resources-plugin</artifactId> 
     <version>2.6</version> 
    </plugin> 
    ... 
</plugins> 

當我與調試命令行中運行它,這就是它說。但是在它聲稱它正在過濾文件的目錄中找不到文件(請原諒我的結尾介詞)。

[INFO] Copying 8 resources 
[DEBUG] file apsmonitoring.properties has a filtered file extension 
[DEBUG] filtering /Volumes/xyz/mexp-removeDAL/mexp-webapp/src/main/resources/apsmonitoring.properties to /Volumes/xyz/mexp-removeDAL/mexp-webapp/target/classes/apsmonitoring.properties 
[DEBUG] file config.xml has a filtered file extension 
[DEBUG] filtering /Volumes/xyz/mexp-removeDAL/mexp-webapp/src/main/resources/config.xml to /Volumes/xyz/mexp-removeDAL/mexp-webapp/target/classes/config.xml 
[DEBUG] file email-configuration.properties has a filtered file extension 
[DEBUG] filtering /Volumes/xyz/mexp-removeDAL/mexp-webapp/src/main/resources/email-configuration.properties to /Volumes/xyz/mexp-removeDAL/mexp-webapp/target/classes/email-configuration.properties 
[DEBUG] file log4j.real.xml has a filtered file extension 
[DEBUG] filtering /Volumes/xyz/mexp-removeDAL/mexp-webapp/src/main/resources/log4j.real.xml to /Volumes/xyz/mexp-removeDAL/mexp-webapp/target/classes/log4j.real.xml 
[DEBUG] file log4j.xml has a filtered file extension 
[DEBUG] filtering /Volumes/xyz/mexp-removeDAL/mexp-webapp/src/main/resources/log4j.xml to /Volumes/xyz/mexp-removeDAL/mexp-webapp/target/classes/log4j.xml 
[DEBUG] file mexp.properties has a filtered file extension 
[DEBUG] filtering /Volumes/xyz/mexp-removeDAL/mexp-webapp/src/main/resources/mexp.properties to /Volumes/xyz/mexp-removeDAL/mexp-webapp/target/classes/mexp.properties 
[DEBUG] file mexp_globals.properties has a filtered file extension 
[DEBUG] filtering /Volumes/xyz/mexp-removeDAL/mexp-webapp/src/main/resources/mexp_globals.properties to /Volumes/xyz/mexp-removeDAL/mexp-webapp/target/classes/mexp_globals.properties 
[DEBUG] file mexp_messages.properties has a filtered file extension 
[DEBUG] filtering /Volumes/xyz/mexp-removeDAL/mexp-webapp/src/main/resources/mexp_messages.properties to /Volumes/xyz/mexp-removeDAL/mexp-webapp/target/classes/mexp_messages.properties 
[DEBUG] no use filter components 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.509s 
[INFO] Finished at: Tue Jan 21 15:10:28 EST 2014 
[INFO] Final Memory: 4M/81M 
[INFO] ------------------------------------------------------------------------ 
+1

您是否使用IDE生成輸出或命令行?爲了解決Maven特定的問題,我建議你使用命令行。 –

+0

查看更多內容;我一直在使用它們,但是我在命令行上添加了運行它的輸出。 – barclay

+0

解決。顯然intelliJ隱藏目標/類目錄及其所有內容。當我從命令行查看時,我可以看到我的所有屬性文件,按照承諾完美過濾和複製。但更重要的是,我甚至不需要專門使用maven-resources-plugin,只要' ... true ...'存在,maven本身就能夠很好地插值。 HTH別人。 – barclay

回答

0

有關於這上的IntelliJ問題跟蹤一個問題:IDEA-75538輸出目錄不應該被自動隱藏運行Maven構建

時,該解決方案建議有此:

有禁止排除「目標」的選項。請參閱設置 - > Maven - >導入 - >「排除構建目錄」

+0

我對此抱有希望,但是在Maven的 - >導入下我的智能設置中沒有看到該選項。 – barclay

+0

請嘗試跟進該問題。根據我的經驗,JetBrains人員確實會對這些問題做出迴應。該問題已提交給舊版本的IntelliJ,並且可能已重新移動的設置可能已被重命名。 – rec

+0

我爲該問題添加了評論 - 感謝指向它的指針。實際上,我確實看到了'target'目錄,但沒有看到它下面的'classes'目錄(顯然,不是'classes'目錄中的文件)。所以可能他們認爲他們「解決了」這個問題...... – barclay

相關問題