2014-01-21 44 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

相关问题