[flexcoders] Compiling Flex files with Ant and mxmlc.jar

2005-05-25 Thread Brett Palmer
I've been trying to create a platform neutral build for our flex
application using Ant and mxmlc.jar but I can't get the configuration
to work.  When I run the build I always get an class not found
exception for the flex/tools/Mxmlc class.  I can build flex with Ant
if I use the mxmlc.exe compiler directly from Ant, but I wanted the
build to work without requiring the compiler script or executable.

Here is my current Ant target that is not working:

target name=compile_flex_jar depends=init, flex_classpath

  echo message=mxmlc.jar = ${mxmlc.jar}/
  echo message=flex_config = ${flex_config}/
  echo message=flex_file = ${flex_file}/
  echo message=flex.class.path = ${flex.class.path}/
  echo message=flex_jars.dir = ${flex_jars.dir}/
  echo message=flex_home.dir = ${flex_home.dir}/

  java jar=${mxmlc.jar} fork=true dir=c:\dev\in2m\in2m\flex
failonerror=true 

jvmarg value=-Dassert -Dapplication.home=${env.FLEX_HOME}
-Xms256M -Xmx512M /
classpath
  path refid=flex.class.path/
pathelement 
location=c:/dev/in2m/in2m/flex/webapp/mvelopes/WEB-INF/flex/jars/mxmlc.jar/
/classpath
arg value=-configuration ${flex_config} ${flex_file} /
  /java

/target

Even when I hard code the mxmlc.jar file in the class path executing
mxmlc.jar doesn't find the correct class.

Is anyone else using Ant and mxmlc.jar to compile their Flex files and
if so can you post a solution showing the correct configuration?

Thanks in advance for your help.


Brett


 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




Re: [flexcoders] Compiling Flex files with Ant and mxmlc.jar

2005-05-25 Thread Joe Berkovitz
Here's a working Ant script(this is run in an exploded web application 
dir, but that's easy to change):

 java jar=${flex.mxmlc.jar} dir=${app.dir} fork=true
   arg line=-flexlib ${flex.dist.lib} -configuration 
WEB-INF/flex/flex-config.xml -webroot . -o index.mxml.swf index.mxml/
 /java

Note that when using the jar= argument to java, one doesn't specify a 
classpath.  That's probably your problem.

.   ..  . ...j


Brett Palmer wrote:
 I've been trying to create a platform neutral build for our flex
 application using Ant and mxmlc.jar but I can't get the configuration
 to work.  When I run the build I always get an class not found
 exception for the flex/tools/Mxmlc class.  I can build flex with Ant
 if I use the mxmlc.exe compiler directly from Ant, but I wanted the
 build to work without requiring the compiler script or executable.
 
 Here is my current Ant target that is not working:
 
 target name=compile_flex_jar depends=init, flex_classpath
 
   echo message=mxmlc.jar = ${mxmlc.jar}/
   echo message=flex_config = ${flex_config}/
   echo message=flex_file = ${flex_file}/
   echo message=flex.class.path = ${flex.class.path}/
   echo message=flex_jars.dir = ${flex_jars.dir}/
   echo message=flex_home.dir = ${flex_home.dir}/
 
   java jar=${mxmlc.jar} fork=true dir=c:\dev\in2m\in2m\flex
 failonerror=true 
 
 jvmarg value=-Dassert -Dapplication.home=${env.FLEX_HOME}
 -Xms256M -Xmx512M /
 classpath
   path refid=flex.class.path/
   pathelement 
 location=c:/dev/in2m/in2m/flex/webapp/mvelopes/WEB-INF/flex/jars/mxmlc.jar/
 /classpath
   arg value=-configuration ${flex_config} ${flex_file} /
   /java
   
 /target
 
 Even when I hard code the mxmlc.jar file in the class path executing
 mxmlc.jar doesn't find the correct class.
 
 Is anyone else using Ant and mxmlc.jar to compile their Flex files and
 if so can you post a solution showing the correct configuration?
 
 Thanks in advance for your help.
 
 
 Brett
 
 
  
 Yahoo! Groups Links
 
 
 
  
 
 
 
 



 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




Re: [flexcoders] Compiling Flex files with Ant and mxmlc.jar

2005-05-25 Thread Brett Palmer
Joe,

Thanks for the information.  I'm trying to compile the flex file in an
exploded web application as well, but I'm still getting a no class
found exception.  Here are some comments and questions to clarify my
problem:

1. Here is my exploded flex web application directory structure
relative to my build.xml:

flex/
- contains my build.xml file

flex/webapp/MyApplication
- root context for my webapp application
- contains MyApplication.mxml

flex/webapp/MyApplication/WEB-INF/flex/jars
- contains Flex jar libraries (i.e. mxmlc.jar)


2. With the fork option set to true can I still use relative paths or
do I need to use full paths?


3. Here are some questions with regards to your suggested parameter
and my assumptions as to what they should point be:

* jar=${flex.mxmlc.jar}
- Should be a relative path to the mxmlc.jar file (i.e.
webapp/MyApplication/WEB-INF/flex/jars/mxmlc.jar)

* dir=${app.dir}
- I'm not sure what this should point to.  Should this be my current
working directory or root context to my web application?

* ${flex.dist.lib}
- I assume this points to the Flex jars directory (i.e.
webapp/MyApplication/WEB-INF/flex/jars)

* webroot
- I assume this should point to the root directory of my web application.


If you have further information on the above questions I would appreciate it.

Thanks again,

Brett

On 5/25/05, Joe Berkovitz [EMAIL PROTECTED] wrote:
 Here's a working Ant script(this is run in an exploded web application
 dir, but that's easy to change):
 
  java jar=${flex.mxmlc.jar} dir=${app.dir} fork=true
arg line=-flexlib ${flex.dist.lib} -configuration
 WEB-INF/flex/flex-config.xml -webroot . -o index.mxml.swf index.mxml/
  /java
 
 Note that when using the jar= argument to java, one doesn't specify a
 classpath.  That's probably your problem.
 
 .   ..  . ...j
 
 
 Brett Palmer wrote:
  I've been trying to create a platform neutral build for our flex
  application using Ant and mxmlc.jar but I can't get the configuration
  to work.  When I run the build I always get an class not found
  exception for the flex/tools/Mxmlc class.  I can build flex with Ant
  if I use the mxmlc.exe compiler directly from Ant, but I wanted the
  build to work without requiring the compiler script or executable.
 
  Here is my current Ant target that is not working:
 
  target name=compile_flex_jar depends=init, flex_classpath
 
echo message=mxmlc.jar = ${mxmlc.jar}/
echo message=flex_config = ${flex_config}/
echo message=flex_file = ${flex_file}/
echo message=flex.class.path = ${flex.class.path}/
echo message=flex_jars.dir = ${flex_jars.dir}/
echo message=flex_home.dir = ${flex_home.dir}/
 
java jar=${mxmlc.jar} fork=true dir=c:\dev\in2m\in2m\flex
  failonerror=true 
 
  jvmarg value=-Dassert -Dapplication.home=${env.FLEX_HOME}
  -Xms256M -Xmx512M /
  classpath
path refid=flex.class.path/
pathelement 
  location=c:/dev/in2m/in2m/flex/webapp/mvelopes/WEB-INF/flex/jars/mxmlc.jar/
  /classpath
arg value=-configuration ${flex_config} ${flex_file} /
/java
 
  /target
 
  Even when I hard code the mxmlc.jar file in the class path executing
  mxmlc.jar doesn't find the correct class.
 
  Is anyone else using Ant and mxmlc.jar to compile their Flex files and
  if so can you post a solution showing the correct configuration?
 
  Thanks in advance for your help.
 
 
  Brett
 
 
 
  Yahoo! Groups Links
 
 
 
 
 
 
 
 
 
 
 
 
 Yahoo! Groups Links
 
 
 
 
 
 



 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




Re: [flexcoders] Compiling Flex files with Ant and mxmlc.jar

2005-05-25 Thread Joe Berkovitz
Brett,  here are some answers that I hope will be helpful.


 2. With the fork option set to true can I still use relative paths or
 do I need to use full paths?

You can use relative paths.  Relative paths in arguments to the java 
program will be relative to the dir attribute of the java task, 
while relative paths in attributes of the java task itself (like the 
jar file path) are relative to wherever Ant is running.


 3. Here are some questions with regards to your suggested parameter
 and my assumptions as to what they should point be:
 
 * jar=${flex.mxmlc.jar}
 - Should be a relative path to the mxmlc.jar file (i.e.
 webapp/MyApplication/WEB-INF/flex/jars/mxmlc.jar)

Correct.  It needn't be relative, but if it is, it will be relative to 
Ant's current directory.

 * dir=${app.dir}
 - I'm not sure what this should point to.  Should this be my current
 working directory or root context to my web application?

In my example, it is the doc root of the web application.  This is the 
working directory for the Java process in which MXMLC runs.

 * ${flex.dist.lib}
 - I assume this points to the Flex jars directory (i.e.
 webapp/MyApplication/WEB-INF/flex/jars)

*** Nope, that has to point to the lib/ directory in your Flex 1.5 
distribution.  (e.g. C:\Program Files\Macromedia\Flex\lib).  This is 
probably your current problem.

 * webroot
 - I assume this should point to the root directory of my web application.

Correct.



 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/