如何使用Flexmojos设置主题?

chr*_*ris 7 apache-flex flexmojos flex-mojos flex4

使用flexmojos进行编译时,我收到警告:

[警告]该部分或任何scope ="theme"依赖项中未明确定义任何主题.Flexmojos现在正试图找出要包含的主题.(为了避免此警告,您应该明确说明您的主题依赖项)

[警告]添加spark.css主题是因为s​​park.swc作为依赖项包含在内

我试过添加:

<dependency>
    <groupId>com.adobe.flex.framework</groupId>
    <artifactId>spark</artifactId>
    <type>swc</type>
    <scope>theme</scope>
    <version>${flex.sdk.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

但我只是得到一个错误:

com.adobe.flex.framework:spark:swc必须是[compile,runtime,system]之一,但是'theme'

我只想使用标准的Spark主题.

谢谢

gMa*_*ale 2

我遇到了同样的问题(添加主题有效,但它会产生丑陋的警告)。我通过显式引用主题的 CSS 文件来修复它:

  1. 将以下内容添加到您的 flexmojos 配置中:

    <themes>
        <theme>spark-theme-${flex.sdk.version}.css</theme>
    </themes>
    
    Run Code Online (Sandbox Code Playgroud)
  2. 添加主题作为依赖项:

    <dependency>
        <groupId>com.adobe.flex.framework</groupId>
        <artifactId>spark-theme</artifactId>
        <version>${flex.sdk.version}</version>
        <type>css</type>
    </dependency>
    
    Run Code Online (Sandbox Code Playgroud)
  3. 将依赖项拉入您的输出目录。有多种方法可以做到这一点,包括简单的蚂蚁复制。我选择使用maven依赖插件:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
            <execution>
                <id>copy-theme-file</id>
                <phase>process-resources</phase>
                <goals>
                    <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                    <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                    <includeArtifactIds>spark-theme</includeArtifactIds>
                </configuration>
            </execution>
        </executions>
    </plugin>
    
    Run Code Online (Sandbox Code Playgroud)

按照以下步骤将 Spark 主题的 CSS 文件复制到输出目录(大多数情况下为 /target/classes),并在 flexmojos 配置中显式引用 CSS 文件。

这对我来说完全摆脱了所有主题警告。我希望这可以帮助别人。