如何替换已编译的swf文件中的翻译?

时间:2016-04-06 11:07:27

标签: maven flash flex

我有一个由flexmojos-maven-plugin在swf中编译的flex项目,它在另外两个项目中使用。首先是默认翻译,第二个我想将其更改为自定义翻译。我尝试编译为swc然后在第二个项目中使用其他翻译更改区域设置文件但是maven构建失败了。
更改pom配置http://www.adobe.com/devnet/flex/articles/flex-maven-flexmojos-pt1.html但它没有帮助我。

它是我的flex项目的pom:

<parent>
  <artifactId>project-parent</artifactId>
  <groupId>com.company.surveo</groupId>
  <version>2.9.2-SNAPSHOT</version>
</parent>
<artifactId>surveo-flex</artifactId>
<packaging>swf</packaging>

<build>
  <sourceDirectory>src/main/flex</sourceDirectory>
  <plugins>
     <plugin>
        <groupId>org.sonatype.flexmojos</groupId>
        <artifactId>flexmojos-maven-plugin</artifactId>
        <extensions>true</extensions>

        <dependencies>
           <dependency>
              <groupId>com.adobe.flex</groupId>
              <artifactId>compiler</artifactId>
              <version>${flex.version}</version>
              <type>pom</type>
           </dependency>
        </dependencies>
        <configuration>
           <optimize>true</optimize>
           <showWarnings>false</showWarnings>
           <extensions>true</extensions>
           <configFile>flex-config.xml</configFile>

           <definesDeclaration>
              <property>
                 <name>CONFIG::debug</name>
                 <value>false</value>
              </property>
              <property>
                 <name>CONFIG::release</name>
                 <value>true</value>
              </property>
           </definesDeclaration>

           <debug>false</debug>
           <contextRoot>/surveo-webapp</contextRoot>
           <swfVersion>15</swfVersion>
           <targetPlayer>11.2</targetPlayer>
           <sourceFile>Surveo.mxml</sourceFile>
           <resourceBundlePath>${basedir}/locale/{locale}</resourceBundlePath>
           <compiledLocales>
              <locale>en_US</locale>
              <locale>pl_PL</locale>
           </compiledLocales>
           <allowSourcePathOverlap>true</allowSourcePathOverlap>
        </configuration>
     </plugin>
  </plugins>
  <resources>
     <resource>
        <directory>${basedir}/target/generated-resources</directory>
        <filtering>true</filtering>
     </resource>
     <resource>
        <directory>${basedir}/src/main/resources</directory>
        <includes>
           <include>**/*</include>
        </includes>
     </resource>
  </resources>
</build>
<dependencies>
  <dependency>
     <groupId>com.company.surveo</groupId>
     <artifactId>surveo-flex-common</artifactId>
     <type>swc</type>
  </dependency>
  <dependency>
     <groupId>com.company.flex</groupId>
     <artifactId>autocomplate</artifactId>
     <type>swc</type>
  </dependency>
  <dependency>
     <groupId>com.company.flex</groupId>
     <artifactId>flexlib</artifactId>
     <type>swc</type>
  </dependency>
  <dependency>
     <groupId>com.adobe.flex.framework</groupId>
     <artifactId>flex-framework</artifactId>
     <type>pom</type>
  </dependency>
</dependencies>
<profiles>
  <profile>
     <id>m2e</id>
     <activation>
        <property>
           <name>m2e.version</name>
        </property>
     </activation>
     <build>
        <plugins>
           <plugin>
              <groupId>org.maven.ide.eclipse</groupId>
              <artifactId>lifecycle-mapping</artifactId>
              <version>1.0.0</version>
              <configuration>
                 <mappingId>customizable</mappingId>
                 <configurators>
                    <configurator id="org.maven.ide.eclipse.configuration.flex.configurator" />
                 </configurators>
                 <mojoExecutions>
                    <mojoExecution>
                       org.apache.maven.plugins:maven-resources-plugin::
                    </mojoExecution>
                 </mojoExecutions>
              </configuration>
           </plugin>
        </plugins>
        <pluginManagement>
           <plugins>
              <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-resources-plugin</artifactId>
                 <version>2.5</version>
              </plugin>
           </plugins>
        </pluginManagement>
     </build>
  </profile>
</profiles>
</project>

尝试构建时出现此错误:

[ERROR] Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:3.9:compile-swc (default-compile-swc) on project surveo-flex: Error compiling! -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:3.9:compile-swc (default-compile-swc) on project surveo-flex: Error compiling!
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error compiling!
    at org.sonatype.flexmojos.compiler.AbstractCompilerMojo.callCompiler(AbstractCompilerMojo.java:1141)
    at org.sonatype.flexmojos.compiler.AbstractCompilerMojo.run(AbstractCompilerMojo.java:2404)
    at org.sonatype.flexmojos.AbstractIrvinMojo.execute(AbstractIrvinMojo.java:155)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more

maven和java(mvn -v)的版本:

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T15:51:42+02:00)
Maven home: D:\Installed\apache-maven-3.2.2
Java version: 1.8.0_40, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_40\jre
Default locale: pl_PL, platform encoding: Cp1250
OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "dos"

是否可以更改此类翻译?或者我完全错了?

1 个答案:

答案 0 :(得分:0)

您遇到编译错误,必须先解决此问题。 此外,<configuration>属于<plugin>。我想swf包装有一个插件。 在

中定义
<build><plugins><plugin>..</plugin><plugins><build>

<build>
<plugins>
  <plugin>
    <artifactId>maven-myquery-plugin</artifactId>
    <version>1.0</version>
    <configuration>
      <url>http://www.foobar.com/query</url>
      <timeout>10</timeout>
      <options>
        <option>one</option>
        <option>two</option>
        <option>three</option>
      </options>
    </configuration>
  </plugin>
</plugins>
</build>

有关详细说明,请参阅maven plugin configuration