2012-07-29 124 views
-1

嗨,我一直在建立一个flex项目,它基本上分为3个模块,一个flex,一个java和一个战争项目。能够编译所有,但flexmojos:copy-flex-resources插件仅将“.swf”文件复制到webapp目录中。还有其他文件,如跳过的HTML包装器。有没有人把它整理出来。谢谢!flexmojos:复制flex资源不复制资源文件

我的SWF POM

SWF应用程序

<properties> 
    <path_to_services_config_xml>${basedir}/src/main/resources/services-config.xml</path_to_services_config_xml> 
</properties> 

<build> 
    <sourceDirectory>src/main/flex</sourceDirectory> 
    <testSourceDirectory>src/test/flex</testSourceDirectory> 
    <directory>target</directory> 
    <plugins> 
     <plugin> 
      <groupId>org.sonatype.flexmojos</groupId> 
      <artifactId>flexmojos-maven-plugin</artifactId> 
      <!-- <version>3.8</version> --> 
      <executions> 
       <execution> 
        <id>html-wrapper</id> 
        <goals> 
         <goal>wrapper</goal> 
        </goals> 
        <configuration> 
         <templateURI>folder:/html-template</templateURI> 
         <parameters> 
          <swf>${project.build.finalName}</swf> 
          <width>100%</width> 
          <height>100%</height> 
          <version_major>${flash.major}</version_major> 
          <version_minor>${flash.minor}</version_minor> 
          <version_revision>${flash.revision}</version_revision> 
          <bgcolor>#FFFFFF</bgcolor> 
         </parameters> 
         <htmlName>Main</htmlName> 
         <!-- <targetPlayer>${flash.major}.${flash.minor}.${flash.revision}</targetPlayer> --> 
        </configuration> 
       </execution> 
      </executions> 
      <dependencies> 
       <dependency> 
        <groupId>com.adobe.flex.compiler</groupId> 
        <artifactId>flex-compiler-oem</artifactId> 
        <version>4.5.1.21328</version> 
       </dependency> 
      </dependencies> 
      <extensions>true</extensions> 
      <configuration> 
       <debug>true</debug> 
       <!-- <output>target/bin/</output> <sourcePaths> <path>src/main</path> 
        </sourcePaths> Configuration to copy assets (Images) folder to target --> 
       <includeFileSets> 
        <fileset> 
         <directory>src/main/assets</directory> 
         <includes> 
          <include>*.*</include> 
         </includes> 
        </fileset> 
       </includeFileSets> 

       <!-- service-config.xml specification (path defined above) --> 
       <services>${path_to_services_config_xml}</services> 

       <!-- Context Root URL --> 
       <contextRoot>clv-web-0.3</contextRoot> 
       <localesCompiled> 
        <locale>en_US</locale> 
        <locale>fr_FR</locale> 
       </localesCompiled> 
       <localesSourcePath>${basedir}/src/main/locale/{locale}</localesSourcePath> 
       <!-- <localesSourcePath>${basedir}/src/main/locale/fr_FR</localesSourcePath> --> 
       <!-- <templateURI>${basedir}/html-template/</templateURI> <outputDir>target/flex-html</outputDir> 
        <htmlName>myindex.html</htmlName> <parameters> <swf>${build.finalName}</swf> 
        </parameters> --> 
      </configuration> 
      <!-- <executions> <execution> <goals> <goal>wrapper</goal> </goals> </execution> 
       </executions> --> 
     </plugin> 
    </plugins> 
</build> 

<dependencies> 
    <dependency> 
     <groupId>com.adobe.flex.framework</groupId> 
     <artifactId>flex-framework</artifactId> 
     <version>4.5.1.21328</version> 
     <type>pom</type> 
    </dependency> 

    <dependency> 
     <groupId>com.adobe.flexunit</groupId> 
     <artifactId>flexunit</artifactId> 
     <version>0.85</version> 
     <type>swc</type> 
     <scope>test</scope> 
    </dependency> 

和我的战争POM是

<packaging>war</packaging> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>org.sonatype.flexmojos</groupId> 
      <artifactId>flexmojos-maven-plugin</artifactId> 
      <version>4.1-beta</version> 
      <extensions>true</extensions> 
      <executions> 
       <!-- <execution> <id>wrapper</id> <phase>generate-resources</phase> 
        <goals> <goal>wrapper</goal> </goals> <configuration> <wrapperArtifact> <groupId>com.cat.clv.swf</groupId> 
        <artifactId>clv-swf</artifactId> <version>0.3</version> </wrapperArtifact> 
        <htmlName>Main</htmlName> </configuration> </execution> --> 
       <execution> 
        <goals> 
         <goal>copy-flex-resources</goal> 
        </goals> 
        <configuration> 
        <webappDirectory>>${basedir}/src/main/webapp/demo</webappDirectory> 
         <stripVersion>true</stripVersion> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 

     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <version>2.2</version> 
      <configuration> 
       <webResources> 
        <resource> 
         <!-- this is relative to the pom.xml directory --> 
         <directory>src/main/webapp</directory> 
        </resource> 
       </webResources> 
       <debug>true</debug> 
       <!-- <warSourceExcludes>index.template.html</warSourceExcludes> <webResources> 
        <resource> <directory>target</directory> </resource> </webResources> --> 
      </configuration> 
     </plugin> 

回答

0

我是谁已正式接管的Flexmojos的发展的人。

您遇到的问题可能与Flex 3.x中的某些更改有关(不记得版本)我遇到了与您相同的问题。在寻找原因时,我发现flexmojos无法确定项目pom中的finalName,因为在某些情况下,maven会抛出错误。当我自己指定finalName时,我通过在copy-flex-resources配置中设置false来解决问题。最终这有助于。

我不得不在另一个项目中使用的另一个解决方案是在我的战争项目中明确使用copy-flex-resources mojo的oder版本。 3.7.1似乎是没有这个问题的最后一个版本。

不幸的是,我还没有设法解决这个错误,但它仍然在我的雷达。

克里斯

1

我不得不与我固定由warSourceDirectoryPath增加在SWF项目的包装目标配置的输出目录的Flexmojos Maven的插件版本3.8一个非常类似的配置问题:

我定义属性: warSourceDirectoryPath = ../workbench-server/src/main/webapp/flex

<plugin> 
    <groupId>org.sonatype.flexmojos</groupId> 
    <artifactId>flexmojos-maven-plugin</artifactId> 
    <version>3.8</version> 
    <executions> 
     <execution> 
      <id>flex-ui-wrapper</id> 
      <phase>generate-resources</phase> 
      <goals> 
       <goal>wrapper</goal> 
      </goals> 
      <configuration> 
       <templateURI>folder:/html-template</templateURI> 
        <templateOutputDirectory>${project.build.directory}/templates</templateOutputDirectory> 
       <outputDirectory>${warSourceDirectoryPath}</outputDirectory> 
       <parameters> 
        <swf>${project.build.finalName}</swf> 
        <title>Workbench</title> 
        <application>myapp</application> 
       </parameters>   
       <htmlName>Workbench</htmlName> 
      </configuration> 
     </execution> 
    </executions>  
    <dependencies> 
     ...  
    </dependencies> 
    <extensions>true</extensions>  
    <configuration> 
     <debug>true</debug> 
     <sourceFile>${basedir}/src/main/flex/Workbench.mxml</sourceFile> 
     <contextRoot>/workbench-server</contextRoot>   
     <generateHtmlWrapper>true</generateHtmlWrapper> 
     <targetPlayer>11.1.0</targetPlayer> 
     <!-- <services>generated-resources</services> this is the default --> 
    </configuration> 
    </plugin> 

希望有所帮助。