script to execute the eclipse PDE Tools > Build site - eclipse

i want to write a script to do the Build site of plugin Update site site.xml?
i could not find a way to do this?
i found very easy to build a plugin feature. I can automatically creat the ant file build.xml via eclipse but i could not find the same for the update site.xml
thank you all
stefania

Are you trying to build an Eclipse plugin from Ant? You want to use the Ant4Eclipse external add-on for Ant. It lets you build the run-configurations you've made in Eclipse (right click>run as>...) from your .project file. You can download it here and there is a tutorial here.
I attempted to do what you're asking at a previous job without using Ant4Eclipse, I don't remember how I got it working, but I do remember it being extremely difficult.
Edit: you can build an Eclipse update site from the command line, which can be run from Ant. There is some [possibly out of date] documentation here, but I found you a sample from an Apache projects build.xml:
<target name="build-site" depends="init">
<copy todir="target/eclipse-update-site/web" preservelastmodified="true">
<fileset dir="web"/>
</copy>
<copy todir="target/eclipse-update-site" file="index.html" preservelastmodified="true"/>
<copy todir="target/eclipse-update-site" file="site.xml" preservelastmodified="true"/>
<!-- copy all the features to the target -->
<copy todir="target/eclipse-update-site/features" preservelastmodified="true" >
<fileset dir="features"/>
</copy>
<!-- see http://wiki.eclipse.org/Update_Site_Optimization -->
<java jar="${eclipse.home}/plugins/org.eclipse.equinox.launcher.jar" fork="true" failonerror="true"
maxmemory="256m">
<arg line="-application org.eclipse.update.core.siteOptimizer"/>
<arg line="-digestBuilder -digestOutputDir=target/eclipse-update-site"/>
<arg line="-siteXML=target/eclipse-update-site/site.xml"/>
</java>
</target>

Related

When using ant in eclipse, standard input does not work?

In demo.Main.main method I do
System.in.read()
In build.xml there is the target
<target name="run">
<java classname="demo.Main" fork="false">
<classpath refid="classpath" />
</java>
</target>
When I go to Eclipse's Console and I give something in , System.in.read() does not see it.
Ant does not support System.in.read().
Use the Ant task <input> for user input instead.

Sencha CMD Ant integration for custom web application

We are trying to integrate the Sencha CMD to our custom application ant script( build.xml) inorder to do minification of js files. Could you please let us know the steps needs to be followed for minifcation of js files . It could be useful if you could provide sample file to achieve this. We tried the following steps as per the manual to just include the sencha.jar which resulted in error "init-sencha-cmd:
[taskdef] Could not load definitions from resource com/sencha/ant/antlib.xml."
I have added the target "init-sencha-cmd" as dependency to target "build" and a property build.dir (basedir="." configured in the start of xml)
<target name="build" depends="init, dependencies, pre-compile, compile, post-compile,init-sencha-cmd" description="Builds the project." />
<property name="build.dir" location="${basedir}"/>
<target name="init-antcontrib">
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${Bundles.WebCharts.lib}/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
</target>
<target name="init-sencha-cmd" depends="init-antcontrib">
<taskdef resource="com/sencha/ant/antlib.xml" classpath="/Users/hatamm/bin/Sencha/Cmd/5.0.3.324/sencha.jar"/>
</target>

.war file won't be updated

I have an old project, built using Google Web Toolkit in Eclipse. When I created it, I did the following steps, in order to get the .war file
GWT Compile Project
Run the following Ant script
<project name="The" basedir="." default="default">
<target name="default" depends="buildwar,deploy"></target>
<target name="buildwar">
<war basedir="war" destfile="The.war" webxml="war/WEB-INF/web.xml">
<exclude name="WEB-INF/**" />
<webinf dir="war/WEB-INF/">
<include name="**/*.jar" />
</webinf>
</war>
</target>
<target name="deploy">
<copy file="The.war" todir="." />
</target>
</project>
Get the .war file
Now, I had to change a port in my project, so I changed it in my code and did the same steps in order to get the .war
However, when I deploy my updated project in Tomcat, it still makes requests to the old port number (I found this reading catalina.out)
So, What can I do in order to get a new, fresh .war ???
You don't mention it, but did you change the ports in tomcat? I assume you did, but I just want to cover all possibilities.

Problem with .cod deployment to simulator

This is a re-post of a topic on the Blackberry Development Forums, but I wasn't getting any answers there, so I thought I would try SO.
I have an in-house library that I developed called Ichabod that is required by one of our applications, Spyder, which runs on the Blackberry 4.5.0 operating system (our original target was for 8330 devices). I had everything working with bb-ant-tools to compile the library, which is in a separate project, and deploy it to C:\Program Files\eclipse\plugins\net.rim.ejde.componentpack4.5.0_4.5.0.21\components\simulator. The Spyder application debugged just fine in the eclipse plugin (I am using Galileo with the 1.1.2 version of the RIM plugin).
Today, however, I went to debug the Spyder application after making a couple of changes to the code (no code changes were made in Ichabod), and found that the application couldn't find the Ichabod module all of a sudden. I noticed that there was now a net.rim.ejde.componentpack4.5.0_4.5.0.28\ directory in my eclipse plugins folder, so thinking that perhaps I updated the component packs without realizing it, I adjusted the target path of the Ichabod library, and rebuilt it with bb-ant-tools. Same problem. So, I tried removing the .cod and all associated files from both the 4.5.0.21 and 4.5.0.28 directories, recompiled the Ichabod library to deploy to both locations, and found that it works with 4.5.0.21, but not with 4.5.0.28 (it's not listed in the modules screen under Settings, either).
I have verified that the .cod file is present in the components\simulator folder, but I can't seem to figure out why the simulators don't recognize the file.
Any suggestions?
My bb-ant-tools build.xml script is attached.
Thanks,
~Scott
<taskdef resource="bb-ant-defs.xml" classpath="lib/bb-ant-tools.jar" />
<property name="jdehome" value="C:\Program Files\eclipse\plugins\net.rim.ejde.componentpack4.5.0_4.5.0.28\components" />
<property name="simulator" value="${jdehome}\simulator" />
<property name="bin" value="${jdehome}\bin" />
<target name="deploy" depends="build" description="Builds and Deploys Project (installs to simulator)">
<copy todir="${simulator}" overwrite="true">
<fileset dir="output">
<include name="*.cod" />
<include name="*.debug" />
<include name="*.csl" />
<include name="*.cso" />
</fileset>
</copy>
</target>
<target name="clean" description="Cleans the output directory">
<delete dir="output"/>
<mkdir dir="output"/>
</target>
<target name="build" depends="clean" description="Builds Project">
<rapc jdehome="${jdehome}"
destdir="output"
output="Ichabod"
quiet="false">
<jdp type="library"
title="Ichabod Library"
vendor="My Company"
version="0.3"
description="Ichabod Library for Mobile Applications"
arguments=""
systemmodule="false"
runonstartup="false"
startuptier="7"
ribbonposition="0">
</jdp>
<src>
<fileset dir=".">
<include name="src/**/*.java" />
<!-- <include name="resource/**/*.*" /> -->
</fileset>
</src>
</rapc>
</target>
</project>
So it appears, after removing the 4.5.0.28 plugin from Eclipse and reinstalling it, that this was what was causing my troubles. I don't know whether this has anything to do with it, but I also removed the JDE 4.5.0 library (which was correctly set at version 28) from the build path of the Ichabod project and replaced it with the same JDE.
After all of this nonsense, my library now shows up in the simulator. Thanks to all who looked at this. Hopefully this will help someone else.

How can I automate (script) creating a war file in eclipse?

It's 5 button clicks to get eclipse to create a deployable war file for my eclipse project, I figure there's probably some eclipse command line option to do the same thing, so I can just write it into a script, but I'm not seeing it.
Use the Ant war task, set up a relevant build file and you can just hit the "external tools" button to execute it.
You could also setup a Maven build for your web project. Typing mvn package from the command line would then build the project for you.
For integration between Maven and Eclipse, see m2Eclipse and Maven Eclipse Plugin.
I cannot say anything about the WAR packaging itself, sorry.
But as I wrote in
How do I automatically export a WAR after Java build in Eclipse? : If you can describe the WAR packaging with an Ant script, you can have that Ant script being executed automatically after each change to your project. Use Project->Properties->Builders->Add->Ant Builder. Give that builder you custom Ant script and it will automatically be executed after the "normal" builders of your project.
You can even specify in the settings of the builder, if it shall only react on changes to specific files and so on.
The Ant builder is kind of a Swiss army knife for anything you want to automate in the project build without having to use the big tools like maven.
This Ant script should work for standard Dynamic Web Project structure of project:
Create Ant build.xml with replacing of two properties at begining:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Deploy From Eclipse to JBoss" basedir="." default="deploy">
<!-- This replace with yours project name and JBoss location: -->
<property name="warfile" value="MyProject"/>
<property name="deploy" value="/home/honza/jboss-as-7.1.1.Final/standalone/deployments"/>
<target name="create">
<war destfile="${warfile}.war" webxml="WebContent/WEB-INF/web.xml" update="true">
<classes dir="build\classes"/>
<fileset dir="WebContent">
<exclude name="WEB-INF/web.xml"/>
</fileset>
</war>
</target>
<target name="copy">
<copy todir="${deploy}" overwrite="true">
<fileset dir=".">
<include name="${warfile}.war"/>
</fileset>
</copy>
</target>
<target name="clear">
<delete includeemptydirs="true">
<fileset dir="${deploy}" defaultexcludes="false">
<include name="${warfile}.*/**" />
</fileset>
</delete>
</target>
<target name="deploy">
<antcall target="create"/>
<antcall target="clear"/>
<antcall target="copy"/>
</target>
</project>
Now should command "ant" do WAR creation and copy them to the JBoss. JBoss automatically deploys wars which finds in deployment directory.
For automatic run after build (Project - Build) add this Buildfile here:
MyProject - Properties - New - Ant builder