• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 472
  • Last Modified:

Flex Build using Maven and add third party as dependency

I need to use swc files like Docker.swc
domain.analysis.swc
domain.dataobjects.swc etc etc in my Flex project. I have added in the lib folder and included this in Flex Build Path. But I need to add this SWC files as maven dependeny. Is there any way to adding SWC files in repository.
0
MeenuNagpal
Asked:
MeenuNagpal
  • 5
  • 4
1 Solution
 
dgofmanCommented:
Yes,
If you want to load from some server use this syntax:

Load dependencies from maven:

                    <dependencies>
            <dependency>
                  <groupId>domain.analysis</groupId>
                  <artifactId>dataobjects</artifactId>
                  <version>1.x</version>
                  <type>swc</type>
            </dependency>
      </dependencies>
0
 
dgofmanCommented:
Now upload to target directory

<executions>
                              <execution>
                                    <id>copy-compile-binaries</id>
                                    <phase>process-resources</phase>
                                    <goals>
                                          <goal>copy</goal>
                                    </goals>
                                    <configuration>
                                          <artifactItems>
                                                <artifactItem>
                                                      <groupId>domain.analysis</groupId>
                                                      <artifactId>dataobjects</artifactId>
                                                      <version>1</version>
                                                      <type>swc</type>
                                                      <overWrite>false</overWrite>
                                                      <destFileName>dataobjects.swc</destFileName>
                                                </artifactItem>
                                          </artifactItems>
                                          <outputDirectory>${basedir}/target</outputDirectory>
                                          <overWriteReleases>true</overWriteReleases>
                                          <overWriteSnapshots>true</overWriteSnapshots>
                                          <overWriteIfNewer>true</overWriteIfNewer>
                                    </configuration>
                              </execution>
                        </executions>
                  </plugin>
0
 
dgofmanCommented:
And your are ready execute ant to compile SWF and using SWC from target directory

<plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                        <execution>
                              <id>compile-flex</id>
                              <phase>compile</phase>
                              <goals>
                                    <goal>run</goal>
                              </goals>
                              <configuration>
                                    <tasks>
                                          <ant antfile='${basedir}/build.xml'>
                                                                              </ant>
                                    </tasks>
                              </configuration>
                        </execution>
                        </executions>
                  </plugin>
0
Get Certified for a Job in Cybersecurity

Want an exciting career in an emerging field? Earn your MS in Cybersecurity and get certified in ethical hacking or computer forensic investigation. WGU’s MSCSIA degree program was designed to meet the most recent U.S. Department of Homeland Security (DHS) and NSA guidelines.  

 
dgofmanCommented:
You mojo or mxmlc compiler to compile SWF using your SWC

<mxmlc file="${src.flex.dir}/${file.name}.mxml"
                        output="${target.flex.dir}/${out.file}.swf"
                        allow-source-path-overlap="true"
                        show-unused-type-selector-warnings="true"
                        keep-generated-actionscript="false"
                        warnings="true"
                        fork="true"
                        maxmemory="512m">
<compiler.library-path dir="${target.flex.dir}" append="true" >
      <include name="dataobjects.swc" />
</compiler.library-path>
0
 
MeenuNagpalAuthor Commented:
Do you mean that swc dependency doesnt work without ant build?
I have created the SWC of my project and trying to import the classes in another project. Even though its added in dependency but its not able to find the classes of SWC file which is added in dependency.
            <dependency>
                  <groupId>com.canberra</groupId>
                  <artifactId>ProSpectMain</artifactId>
                  <version>1.0</version>
                  <type>swc</type>
            </dependency>
Do I Need to chnage the settings in Flash Builder to enable maven dependency?
0
 
dgofmanCommented:
I gave you use case how to download existing SWC from maven repository and build SWF using Flex libraries.
If you want to creating SWC from maven is different story its possible using ANT compilation
0
 
MeenuNagpalAuthor Commented:
I am still not clear with the answers provided by you. Where I need to define the following code snippet
<mxmlc file="${src.flex.dir}/${file.name}.mxml"
                        output="${target.flex.dir}/${out.file}.swf"
                        allow-source-path-overlap="true"
                        show-unused-type-selector-warnings="true"
                        keep-generated-actionscript="false"
                        warnings="true"
                        fork="true"
                        maxmemory="512m">
<compiler.library-path dir="${target.flex.dir}" append="true" >
      <include name="dataobjects.swc" />
</compiler.library-path>

in the build.xml or in my pom  file?
0
 
MeenuNagpalAuthor Commented:
I need to select another Solution
0
 
MeenuNagpalAuthor Commented:
Ant works perefctly fine with Maven
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now