如何使用Flexmojos设置主题?

7

在使用flexmojos编译时,我收到了以下警告:

[警告] 在<dependency>部分或任何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 主题。

谢谢。


【警告】因为spark.swc被作为依赖项包含,所以添加了spark.css主题 - 据说将使用spark主题。难道没有使用吗?关于作用域 - Timofei Davydik
确实如此,它就是这样。然而,我想要摆脱所有不必要的构建警告,以便任何真正的警告更加明显。 - chris
3个回答

2

我也遇到了同样的问题(添加主题可以解决,但会产生丑陋的警告)。我通过明确引用主题的 CSS 文件来解决它:

  1. Add the following to your flexmojos configuration:

    <themes>
        <theme>spark-theme-${flex.sdk.version}.css</theme>
    </themes>
    
  2. Add the theme as a dependency:

    <dependency>
        <groupId>com.adobe.flex.framework</groupId>
        <artifactId>spark-theme</artifactId>
        <version>${flex.sdk.version}</version>
        <type>css</type>
    </dependency>
    
  3. pull the dependency in to your output directory. There are several ways to do this, including a simple ant copy. I chose to use the maven dependency plugin:

    <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/classes),并在flexmojos配置中明确引用CSS文件。

这对我来说完全消除了所有主题警告。希望这能帮到某些人。


0

我正在使用Flex-Mojos 4.1-beta和主题“just work”™,但我不能保证早期版本。

以一个例子为例,引入Spark主题(SDK的一部分):

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

现在,导入我之前自己定义的主题:
    <dependency>
        <groupId>ie.hunt</groupId>
        <artifactId>theme-library</artifactId>
        <version>1.0-SNAPSHOT</version>
        <type>swc</type>
        <scope>theme</scope>
    </dependency>

应用了“spark”主题,然后被我在自己的主题swc中定义的规则覆盖。没有别的事情可做。

使用“插件” ->“配置”的“主题”子部分会创建无用的空指针异常,例如:

 <configuration>
 <themes>
  <theme>spark.css</theme>
 <themes>
 ...
 </configuration>

错误输出:

 [ERROR] Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:4.1-beta:compile-swc (default-compile-swc) on project theme-library: java.lang.NullPointerException -> [Help 1]

不幸的是,该修复程序生成了更多的构建警告。 - Naftuli Kay
我大约8个月前放弃了使用flex-mojo,因为它们对我的产品稳定性几乎没有什么帮助,却浪费了我很多时间。现在我对开发Flex应用程序的建议是:1)使用Intellij 2)不要浪费时间在flex-mojos上 3)将二进制库检入git(或您使用的任何其他版本控制工具)。 - Bryan Hunt

0
或者,更简单的方法是使用这个答案(只需在您的pom文件的dependencyManagementdependencies标签中声明它即可)。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接