Last week Cairngen 2.0 was released, and judging by my Firestats totals there has been on average, roughly 250 downloads per day.
Based on the feedback I have received so far, the single most requested feature users are asking for is an additional target which will generate multiple Event, Command and Business Delegate classes (Sequences) simultaneously.
Ironically, prior to the Cairngen 2.0 release one of the contributors (I don’t remember who, so if you read this please leave a comment and take credit where it is due) added a few additional tasks which did just this.
So after a bit of fine tuning and testing I have added three new targets which are as follows:
Generates multiple Event, Command and Business Delegate classes simultaneously. To do so simply assign a comma delimited list of Sequence names to the sequence.name property in project.properties.
(e.g. sequence.name=Login, Logout, RegisterUser, UnregisterUser)
Generates multiple Event and Command classes simultaneously. To do so simply assign a comma delimited list of Sequence names to the sequence.name property in project.properties.
(e.g. sequence.name=Login, Logout, RegisterUser, UnregisterUser)
Generates multiple Value Object classes simultaneously. To do so simply assign a comma delimited list of VO names to the vo.name property in project.properties.
(e.g. vo.name=Login, Logout, RegisterUser, UnregisterUser)
I have also updated the comments in both the project.properties file and the build.xml files, respectively.
If you have any additional feature requests you would like to see added to Cairngen, or if you have already implemented these features. feel free to leave a comment or send me an email.
Hi Eric,
I am trying to use this with Flex Builder 2.0 and with in build ANT plugin and its giving the error like :
“Could not create task or type of type: loadresource.”
I have checked the ANT version in the flex builder folder and its showing 1.6.5
Can you please help me out?
I can run Cairngen 1.2 but when i try to use 2.1 its giving me the error.
Thanks in advance,
Anupam
Eric, I am trying to use Cairngen 2.1 in FB 3 beta 2 (stand-alone) and getting an error:
BUILD FAILED
C:\…\build.xml:373: Unable to load a script engine manager (org.apache.bsf.BSFManager or javax.script.ScriptEngineManager)
Have you seen this before? Is there a software update I need to install? If so, which one?
Thanks,
Leif
Hey Lief,
You need to upgrade to JRE 6. First download and install at: http://www.java.com/en/download/manual.jsp
Once you have upgraded the Java Runtime, restart Eclipse and from the toolbar select Windows > Preferences > Java (expand) > Installed JREs > Add > Browse (browse to Java Installation and select latest JRE). Click OK.
Restart Eclipse and you should be good to go. Let me know if you have any problems.
– Eric
I’m in the same boat, I get anupam’s error in Flex 2, and I get Leif’ s error in Flex Builder 3. I’m sure both cases are due to missing libraries we dont have that ant is using but I’m having troubles finding which update I need to point at
Hey Guys,
Make sure you have jre1.6.0 installed and that Eclipse is pointing to it (preferences – Java – installed JREs)
You will also need the ant-contrib llibrary which has been included in Cairngen and configured, so this lib should work out of the box without any modifications needed.
In both cases my thinking is that you need to update to the latest JRE. Try this first and let me know if you have any problems.
– Eric
Hi Eric,
I have updated the JRE to 1.6 and my Flex Builder is now pointing to the same JRE
but I am still facing the same problem 🙁
I am getting the error while running the build file.
C:\Documents and Settings\…\build.xml:36: Could not create task or type of type: loadresource.
Ant could not find the task or a class this task relies upon.
Can you tell me what version of ANT you are using and is there any way to upgrade the ANT plugin for Flex Builder 2.0?
Thanks in advance,
Anupam
Awesome tool Eric! ANT rocks. Thanks for the hard work.
Your fix worked for Flex Builder 3.0 (I must of been typing while you gave your first response that worked)
Flex Builder 2 is pointing at the latest JRE but it seems loadresource requires ant 1.7
http://ant.apache.org/manual/CoreTasks/loadresource.html
I couldnt for the life of me find how to update Flex2 with ant 1.7 using their software updater so I just copied the ant 1.7 plugin from Flex3 and all was well in Flex2 land
Thanks for your help and for the great plugin!
Anupam,
Based on the error you are receiving it appears the build script is unable to locate ant-contrib.jar.
To be certain, send me the exact target you are running when you receive this error and I will help you debug it.
– Eric
Thx this is a great help!
If you need 1.6 for leopard check out soylatte http://landonf.bikemonkey.org/static/soylatte/
Hey Eric,
I’m running into a new error that I can’t seem to solve.
log:
add-command-to-controller:
[echo] @Invoking Cairngen on [PreperationModule] –> Inserting addCommand in FrontController for GetUserConfigEvent and GetUserConfigCommand
BUILD FAILED
/Users/Bjorn/dev/ant/projects/cairngen/build.xml:362: Unable to create javax script engine for javascript
I believe this has to do with the Java 6 version I installed.
I assume thats what enables you to run the javascript defined in the scriptdef tag ?
Any help on this one, please.
Hii Eric,
I am using the Cairngen 2.1
It is running fine except that, it only generates the
-directory structure,
-Services.mxml,
-Controller.as,
-ModelLocator.as.
It doesn’t generate any Command, Event or VO’s.
Here is project.properties file:
#### PROJECT PROPERTIES ####
project.name =Stir
root.dir =C:/tomcat/webapps/stirblaze/flex_src
com.dir =com
domain.dir =flex
project.dir =stir
cairngorm.version =2.1
#### CREATING SEQUENCES ####
sequence.name =Login, Logout, RegisterUser, Employee
#### CREATING VOs ####
vo.name =Login, Logout, RegisterUser, Employee
#### ENABLE REGISTER REMOTE CLASS META-DATA IN VO ####
vo.remoteClass =true
#### READ / WRITE MANAGEMENT ####
overwrite.files =true
prompt.on.delete =true
#### LOG MODIFICATIONS ####
log.output =true
#### PROTECTED PROPERTIES ####
namespace =${com.dir}.${domain.dir}.${project.dir}
project-uri =${root.dir}/${com.dir}/${domain.dir}/${project.dir}
Anything that am missing in it??
Thanks.
Hey Manu,
Hmm, I have not encountered this error before. Are you running the “create-sequenxe…” targets? If so it should work fine. The “main” target only generates the Cairngorm directory structure and default classes; basically everything that you said is being created. The main target does not generate sequences and / or VOs. These must be generated by running their respective targets.
Hope that helps.
– Eric
Hello Eric,
loadresource requires ant 1.7 as mentioned before.
Eclipse 3.2.2 have Ant 1.6.5 so Cairngen 2.1 can’t work with it.
btw, in your README.TXT : 1.) Apache Ant 1.5 or greater
Hi Bjorn Schultheiss after a long and hard struggle i found you need to put two jar files in your class path and i got it to work
one :js_engine.jar from jsr223-engines/javascript/build/
available @
two:js.jar from rhino1_6R7
available @ http://www.mozilla.org/rhino/download.html
mac osx java 6 jre ONLY SUPPORTS AppleScript as standard script engine !!!!!
best of luck michel
hi Adnan,
You could change the default ant_home from 1.6.5 to use 1.7, in eclipse, by going to windows->preferences->ant. Here you can click on ANT_HOME and point it to the directory where ant 1.7 is installed.
hope it helps.
Hi Eric,
The probem encountered by Manu is hapening to me too, do you have any suggestion on that?
Thanks
Philip
Hi Guys,
Any suggestion on the problem, VO and Events not being created as explained by Manu?
Thanks
Philip
I’m looking forward to using this, but I too got the
\Flex Builder 3\Amfphptest2\Cairngen 2.1\build.xml:373: Unable to load a script engine manager (org.apache.bsf.BSFManager or javax.script.ScriptEngineManager)
message, in FlexBuilder3.
I downloaded JRE 1.6 as you specified (necessary for FB3?) and pointed FB to it, but got the same error.
Thanks,
Jack
For anyone interested, I’ve worked out how to get Cairngen running on Tiger. It probably works for Leopard too. It wasn’t easy as there’s no (official) JRE 1.6 available but now I’ve got there, it’s reasonably straightforward. You just have to add BSF, Rhino and Commons-Logging jars to your Ant classpath. Like so:
1. Download and copy bsf.jar and js.jar to your Ant lib directory. Get them here:
http://jakarta.apache.org/site/downloads/downloads_bsf.cgi
http://www.mozilla.org/rhino/download.html
2. In Eclipse->Preferences->Ant->Runtime->Classpath, add the 2 jars above (Add External JARs button), as well as org.apache.commons.logging._*.jar (which should already be in your Eclipse plugins directory). I’ve added them to Ant Home Entries which works for me.
That’s really all there is to it. Then, as Eric says, you have to run the appropriate targets in your Ant build file if you want to create delegates, events, vo’s, etc. I couldn’t find an explanation as to the best way to do this so I just added the targets to line 63 of build.xml so it’s now:
depends=”log, create-model-locator, create-front-controller, create-service-locator, create-multiple-sequences-include-delegates, create-multiple-value-objects” />
I hope this helps.
By the way, thanks for all your awesome work on this Eric.
Cheers,
Darren.
Hey Darren,
Thanks for resolving this issue. I simply haven’t had the time to look into some of the latest configuration issues. I do plan on publishing an updated release to Cairngen in the very near future so which should include in the release notes the resolutions to these issues so stay tuned!
– Eric
Just tried what Darren suggested and it worked well so thanks for that and thanks Eric for Cairngen.
Darren, your steps really helped. Erir thank you for putting this all together in the first place! Unfortunately I am running into a different issue now:
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
This is if I try to set it up to use it on a project already in progress and I don’t want to delete all the files. I will continue looking through the docs though as I probably missed something.
Thanks again!
Michael
Great tool. Thanks!
Michael – I had the exact same problem as you (I’m running OSX 10.4 and Eclipse 3.3.2). After doing a lot of hunting around, I found that you just need to include one additional file in your Ant lib directory which includes the LogFactory class. You can download it here: http://commons.apache.org/downloads/download_logging.cgi. Cairngen is now running perfectly on my machine.
I summarized the steps the I had to take on my blog: http://www.rphelan.com/2008/04/12/running-cairngen-on-a-mac/
Hey Guys,
Just FYI: The Cairngen project has been moved to Google Code. Please see:
http://www.ericfeminella.com/blog/2008/03/31/cairngen-project-moved-to-google-code/
http://code.google.com/p/cairngen/
Enjoy,
Eric
thanks a lot Darren and Eric. Thank you so much. you guys rock!!!!
thanks Eric for your great work, this tool saves so much time
Thanks for the tips in the comments Eric, I managed to get your fine generator working after updating JRE (FlexBuilder uses an alternate JRE). It took me a bit to find that I needed to run the generate-sequences/vo tasks on their own, but after that it is off to the races. Cheers!
Eric, having issues with the VO objects I ran the create-value-object (I am using your CairngenExample with no modifications) and it generates one VO with the following constructor (see below).
public class Login,LogOut,CheckIn,CheckOutVO implements IValueObject
{
public function Login,LogOut,CheckIn,CheckOutVO() {
}
}
Hey Jason, All you need to do is run either of the two “create-multiple-sequences…” targets which will take a CSV and create the associated Event, Command and Delegate (optional).
See: http://code.google.com/p/cairngen/wiki/GettingStarted for details.
Best,
Eric