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

[警告]本节或任何scope =“theme”依赖项中未明确定义主题。 Flexmojos现在正在尝试找出要包含的主题。 (为避免此警告,您应明确声明您的主题依赖项)

[警告]添加spark.css主题,因为将spark.swc作为依赖项包括在内

我尝试添加:

<dependency>
    <groupId>com.adobe.flex.framework</groupId>
    <artifactId>spark</artifactId>
    <type>swc</type>
    <scope>theme</scope>
    <version>${flex.sdk.version}</version>
</dependency>

但是我只是得到一个错误:

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

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

谢谢

最佳答案

我遇到了同样的问题(添加主题有效,但是会产生难看的警告)。我通过以下方式显式引用了主题的CSS文件来修复该问题:

  • 将以下内容添加到您的flexmojos配置中:
    <themes>
        <theme>spark-theme-${flex.sdk.version}.css</theme>
    </themes>
    
  • 将主题添加为依赖项:
    <dependency>
        <groupId>com.adobe.flex.framework</groupId>
        <artifactId>spark-theme</artifactId>
        <version>${flex.sdk.version}</version>
        <type>css</type>
    </dependency>
    
  • 将依赖项拉入您的输出目录。有几种方法可以做到这一点,包括简单的ant副本。我选择使用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>
    

  • 执行以下步骤将spark-theme的CSS文件复制到输出目录(在大多数情况下为/target/classs),并在flexmojos配置中显式引用CSS文件。

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

    10-07 19:30
    查看更多