---
title: "flexmjo6.x 自编译并支持flex sdk 4.6"
author: "olive009"
date: "2014-03-02T17:25:58Z"
tags: []
categories: ["编程语言"]
slug: "flexmjo6-x-flex-sdk-4-6"
draft: false
lastmod: "2015-10-19T22:05:14Z"
id: 2024635
url: "https://olive009.iteye.com/blog/2024635"
---

tips: -- flexmojos7.x 只支持 apache 的sdk.

       -- 必须要用适合的jdk版本：JDK1.5至JDK1.7.0-12

       -- 必须使用maven版本不小于 3.04

       -- 在一些旧的项目使用flexmojos6.x的时候要把groupId： org.sonatype.flexmojos 改成：net.flexmojos.oss ，并更新对应的 version。

 

step1: 将flex sdk 4.6 安装到本地repository.下载 apache mavenizer. svn 地址: http://svn.apache.org/repos/asf/flex/utilities/trunk/mavenizer，并按照readme.txt 提示将flex sdk 4.6 安装到本地repository.

此代码已失效，完成本步骤可参照: [http://olive009.iteye.com/admin/blogs/2250142](/admin/blogs/2250142)

 

step2: 下载 flexmojos6.x src. git地址：https://github.com/chrisdutz/flexmojos/tree/flexmojos-6.x

 

step3: 在eclipse 中新建一个纯项目并将flexmojos6.x包含pom.xml文件夹中的所有文件复制到项目根目录。如下图所示：

 

![](http://dl2.iteye.com/upload/attachment/0094/3910/c2bfa37a-7211-3ef1-9c45-9e266c9b1611.png)  
 

step4: 在项目中搜索 flexmojos-parent，将其 version改成：6.0.0。因为在sonatype公司的repository中暂时只包括了version为6.0.0和6.0.1的版本。

![](http://dl2.iteye.com/upload/attachment/0094/3912/47b46554-9a85-3f03-a2b9-800bf28d11ff.png)  
 

step5: 修改maven安装目录中的settings.xml文件。先将其它profile注释掉，并加入如下profile

```
<!-- flexmojos -->
		<profile>
        <id>flex-mojos</id>
            <repositories>
                <!-- Required for regular plugin use until moved over to Maven central repo. -->
                <repository>
                    <id>flex-mojos-repository</id>
                    <url>http://repository.sonatype.org/content/groups/flexgroup/</url>
                    <releases> <enabled>true</enabled> </releases>
                    <snapshots> <enabled>false</enabled> </snapshots>
                </repository>

                <!-- Required for building plugin from source. -->
                <repository>
                    <id>flex-mojos-internal-repository</id>
                    <url>http://repository.sonatype.org/content/groups/public/</url>
                    <releases> <enabled>true</enabled> </releases>
                    <snapshots> <enabled>true</enabled> </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <!-- Required for regular plugin use until moved over to Maven central repo. -->
                <pluginRepository>
                    <id>flex-mojos-plugin-repository</id>
                    <url>http://repository.sonatype.org/content/groups/flexgroup/</url>
                    <releases> <enabled>true</enabled> </releases>
                    <snapshots> <enabled>false</enabled> </snapshots>
                </pluginRepository>

                <!-- Required for building plugin from source. -->
                <pluginRepository>
                    <id>flex-mojos-internal-plugins-repository</id>
                    <url>http://repository.sonatype.org/content/groups/public/</url>
                    <releases> <enabled>true</enabled> </releases>
                    <snapshots> <enabled>true</enabled> </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
```

 设置activeProfiles节点为：

```
<!-- flexmojos -->
	<activeProfiles>
        <activeProfile>flex-mojos</activeProfile>
    </activeProfiles>
```

 

step6: 修改flexmojos-sandbox目录下的pom.xml将以下module注释掉（如果你想改掉编译错误的话也可以不注释）

```
<module>flexmojos-flex3-compatibility-layer</module>
  	<module>flexmojos-flex2-compatibility-layer</module>
```

   
![](http://dl2.iteye.com/upload/attachment/0094/3917/cb5ee491-eeb5-3ecc-bfde-5b98926939a1.png)  
 

 

在项目根目录下的pom.xml搜索 flexmojos-testing，将flexmojos-testing的所有module注释掉（如果你想改掉编译错误的话也可以不注释）。

 

 出问题了？？？

1\. 找不到 flashplayer？

    因为 apache mavenizer 将flashplayer的包名改了，你要将你的flex项目的pom.xml加入以下依赖：

```
<dependencies>
	<dependency>
		<groupId>com.adobe.flash.framework</groupId>
		<artifactId>playerglobal</artifactId>
		<version>11.1</version>
		<type>swc</type>
	</dependency>
</dependencies>
```

 

 附件提供了已经编译了的flexmojos，可用来build flex sdk 4.6 的项目，直接将其解压到maven本地的仓库。