- I am creating project.war file using ant and worklight-ant-builder.jar file in the MFP.
- While my project is build using mfp or via eclipse in the bin the .war file and classes folder have all the things including content in my server->java folder.
- But when i build the ant file using step 1 i dont get the files in my server->java folder.
Note i have verified this by using 7-zip to see the contents in the .war file and also seen the folder classes created by the mobileFirst which contains server->java folder content when i use step 2.
Image Containing the peluk folder which is inside the Java->server->com ( Built using Step 2)
Image which dont have the peluk folder which is inside the Java->server->com (Built using Step 1)
I am using the following ant code.
<taskdef resource="com/worklight/ant/defaults.properties">
<classpath>
<pathelement location="${res.location}\Resources\worklight-ant-builder.jar"/>
</classpath>
</taskdef>
<war-builder projectfolder="bin"
warfile="bin\${proj.brcname}.war"
classesFolder="classes-folder"/>
As @dhineshsundar mentioned in the comments: If you have custom Java code and you're planning on building a project using the Ant task script then you must first compile the Java code into a .class file and specify its location in the Ant task script. Then when building the project using the Ant task script it will also pick up the .class file.
The above does not happen automatically like it happens when using MobileFirst Studio.
See this user documentation topic: http://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.0.0/com.ibm.worklight.deploy.doc/devref/r_ant_tasks_deploy_projects.html
The
<war-builder>
element has the following attributes:projectfolder
attribute specifies the path to your project.destinationfolder
attribute specifies a folder for holding temporary files.warfile
attribute specifies the destination and file name of the generated .war fileclassesFolder
attribute specifies a folder with compiled Java™ classes to - add to the .war file. .jar files in the projectfolder\server\lib directory are added automatically