I am creating webservice using AXIS and running this using ANT script.
<target if="jars.ok" depends="make.repo" name="start.server">
<property name="port" value="7070"/>
<java fork="true" classname="org.apache.axis2.transport.http.SimpleHTTPServer">
<arg value="${build}/repo"/>
<classpath refid="axis2.class.path"/>
<arg value="-p${port}"/>
</java>
</target>
Setted classpath using
<path id="axis2.class.path">
<pathelement path="${java.class.path}"/>
<pathelement path="${maven.class.path}"/>
<fileset dir="${axis2.home}">
<include name="lib/*.jar"/>
<include name="resources/*.properties"/>
</fileset>
</path>
But i am getting error as
[java] log4j:WARN Please initialize the log4j system properly [SimpleHTTPServer]
What do I need to do to fix this issue, thanks a lot
You can not add Property files as classpath, just folders and Jar files.
So here include the whole resources folder:
pathelement path="${axis2.home}/resources"
Related
In eclipse there is a plugin for vaadin.
When mark *.widgetset file in your project and click on on Compile vaading widgetset it compiles widgetset under WebContent\VAADIN\widgetsets. So my question is how to do it from command line without eclipse?
Note that: I've searched, but there are example of maven. This is old project and there is not maven configuration in it
You did not say which Vaadin version you are using but compiler class at least in Vaadin7 seems to be this:
https://vaadin.com/api/framework/7.6.8/com/vaadin/tools/WidgetsetCompiler.html
Not sure of commandline but I have this kind of ANT script for Vaadin7, maybe it will help a bit:
<target name="compile-widgetset" depends="init,resolve">
<delete includeEmptyDirs="true">
<fileset dir="${basedir}/WebContent/VAADIN/gwt-unitCache/" includes="**/*" defaultexcludes="no"/>
</delete>
<java classname="com.vaadin.tools.WidgetsetCompiler" failonerror="yes" fork="yes" maxmemory="600m">
<jvmarg value="-Xms512M"/>
<jvmarg value="-Xmx1024M"/>
<jvmarg value="-Xss8M"/>
<jvmarg value="-Djava.awt.headless=true" />
<arg value="-war"/>
<arg value="WebContent/VAADIN/widgetsets"/>
<arg value="${widgetset}"/>
<arg value="-logLevel"/>
<arg value="DEBUG"/>
<arg value="-style"/>
<arg value="OBF"/>
<classpath>
<pathelement path="${module.src.dir}"/>
<pathelement path="${module.build.dir}/WebContent/WEB-INF/classes" />
<pathelement path="${module.build.dir}/WebContent/WEB-INF/lib" />
<path refid="widgetset.path"/>
</classpath>
</java>
</target>
Compile instructions: https://vaadin.com/docs/v7/framework/clientside/clientside-compiling.html
I figured out using this url
https://github.com/canthony/simple-vaadin-7-compile-widgetset-ivy
I only added manifest tag to include dependecies in the META-INF/MANIFEST.MF file
<war destfile="${artifacts}/${warfilename}"
basedir="${workdir}"
webxml="${webroot}/WEB-INF/web.xml"
>
<manifest>
<attribute name="Dependencies" value="org.jboss.xnio, org.hibernate"/>
</manifest>
<lib dir="${webroot}/WEB-INF/lib" erroronmissingdir="no">
<include name="*.jar"/>
</lib>
<lib dir="${libraries}" erroronmissingdir="no">
<include name="*.jar"/>
</lib>
</war>
I am trying to write a ant build which calls a Java class
<target name="validate" depends="forge-jar">
<taskdef name="spec" classname="SpecBuild" classpathref="java.classpath" />
<spec a="${forge}" mail="${mail}" dd="${dd}" wdd="${wdd}"/>
</target>
<target name="forge-jar" >
<path id="project.class.path">
<pathelement location="classes/" />
<pathelement path="classes/ant/tasks/SpecBuild.class" />
</path>
<path id="java.classpath">
<path refid="project.class.path" />
</path>
<javac includeantruntime="false" srcdir="src" destdir="classes" classpathref="java.classpath">
<filename name="**/SpecBuild.java" />
</javac>
</target>
In the SpecBuild.java class if I use slf4j logger I am getting this warning :-
CLASSPATH element /Users/classes/ant/tasks/SpecBuild.class is not a JAR.
[taskdef] CLASSPATH element /Users/classes/ant/tasks/SpecBuild.class is not a JAR.
Can anyone please help me fix this
You can specify the 'classes' directory in the class path as below. Remove the 'SpecBuild.class' file from pathElement location. You can either use 'includes' property and mention the file name in it or just include the 'classes' directory as below (exclude the JUni test cases package, if you have).
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<pathelement location="classes"/>
<dirset dir="${build.dir}">
<include name="apps/**/classes"/>
<exclude name="apps/**/*Test*"/>`enter code here`
</dirset>
</classpath>
Good luck.
This is my build.xml using ant.
<?xml version="1.0" encoding="UTF-8"?>
<project name="compile" default="css.concatenate" basedir=".">
<property name="charset" value="utf-8"/>
<!-- compile LESS -->
<target name="css.concatenate">
<concat destfile="${basedir}/src/main/webapp/cons/cons.less">
<fileset dir="${basedir}/src/main/webapp/less">
<include name="*.less"/>
</fileset>
</concat>
<echo>cons is done!</echo>
</target>
<target name="lessc" depends="css.concatenate">
<echo>now in compression</echo>
<java classname="CpLess" fork="true">
<arg value="${basedir}/src/main/webapp/cons"/><!-- input folder that contains less file -->
<arg value="${basedir}/src/main/webapp/css"/><!-- output folder -->
<classpath>
<pathelement location="${basedir}/lib/commons-logging.jar"/>
<pathelement location="${basedir}/lib/js.jar"/>
<pathelement location="${basedir}/lib/lesscss-engine.jar"/>
<pathelement location="${basedir}/lib/yuicompressor.jar"/>
<pathelement location="${basedir}/lib/zkjszips.jar"/>
<pathelement location="${basedir}/lib/zkless.jar"/>
<pathelement location="${basedir}/lib/zul.jar"/> <!-- only needed if using _zkmixins.less -->
</classpath>
</java>
</target>
<target name="rename" depends="lessc">
<echo>renaming...</echo>
<rename src="${basedir}/src/main/webapp/css/cons.css.dsp" dest="${basedir}/src/main/webapp/css/core.css"/>
<delete file="${basedir}/src/main/webapp/css/cons.css.dsp.src"/>
<echo>rename done</echo>
</target>
<target name="trasition" >
<echo> in trasition </echo>
</target>
</project>
When I run this, it comes into the error like this:
Buildfile: C:\Users\di_yu\workspace\lessCompiler\build.xml
css.concatenate:
[echo] cons is done!
lessc:
[echo] now in compression
[java] Compiling... C:\Users\di_yu\workspace\lessCompiler\src\main\webapp\cons\cons.less
css.concatenate:
[echo] cons is done!
css.concatenate:
[echo] cons is done!
lessc:
[echo] now in compression
[java] Compiling... C:\Users\di_yu\workspace\lessCompiler\src\main\webapp\cons\cons.less
rename:
[echo] renaming...
[rename] DEPRECATED - The rename task is deprecated. Use move instead.
[delete] Deleting: C:\Users\di_yu\workspace\lessCompiler\src\main\webapp\css\cons.css.dsp.src
[echo] rename done
trasition:
[echo] in trasition
BUILD FAILED
Target "precompile-templates" does not exist in the project "compile".
Total time: 4 seconds
As you can see, it says "precompile-templates" target is not exist. However, I didn't call this task at all. I just delete it from my build.xml and there are no other targets related to it. How does the error come? PS: I use eclipse's run as ANT to run this build.xml.
Did you change the target you want to run after you deleted the unnecessary targets from the file? It looks to me like the run configuration is still using the old target. Use
The problem is that you created a target "precompile-templates", you subsequently deleted it ... and Eclipse is "remembering" the now-obsolete target.
SUGGESTION:
1) "File > Save all", 2) "Project > Clean project" 3) "Run As, Ant build"
See if that works!
Actually, I found out the problem. I still use the old configuration to run the build.xml. The solution is like this:
right click on the build.xml
click 'run as...' then click the external configuration tool
delete the selected launch configurations.
Para aquel que le interese
buil.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="less.compile" default="css.concatenate" basedir=".">
<!-- compile LESS -->
<target name="css.concatenate">
<concat destfile="${basedir}/WebContent/cons/index.less">
<fileset dir="${basedir}/WebContent/less/import">
<include name="*.less"/>
</fileset>
</concat>
<echo>cons is done!</echo>
</target>
<target name="css.lessc">
<java classname="CpLess" fork="true">
<arg value="${basedir}/WebContent/cons"/><!-- output folder -->
<arg value="${basedir}/WebContent/less"/><!-- output folder -->
<classpath>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/commons- logging.jar"/>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/js.jar"/>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/lesscss-engine-1.3.3.jar"/>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/yuicompressor-2.4.7.jar"/>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/zkjszips.jar"/>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/zkless.jar"/>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/zul.jar"/><!-- only needed if using _zkmixins.less -->
</classpath>
</java>
</target>
<target name="lessc">
<java classname="CpLess" fork="true">
<arg value="C:/WKSLuna000/PruebasZul/WebContent/lesssrc"/><!-- output folder -->
<arg value="C:/WKSLuna000/PruebasZul/WebContent/lessbuild"/><!-- output folder -->
<classpath>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/commons-logging.jar"/>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/js.jar"/>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/lesscss-engine-1.3.3.jar"/>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/yuicompressor-2.4.7.jar"/>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/zkjszips.jar"/>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/zkless.jar"/>
<pathelement location="${basedir}/WebContent/WEB-INF/lib/zul.jar"/><!-- only needed if using _zkmixins.less -->
</classpath>
</java>
</target>
</project>
En la carpeta cons/
/zk/
_header.less
_zkminis.less
_skvariables.less
En la carpeta less/
/import/
0index.less
button.less
....
/zk/
_header.less
_zkminis.less
_skvariables.less
Archivo 0index.less:
#import "../bootstrap/less/variables.less";
#import "../bootstrap/less/mixins.less";
#import "zk/_header.less";
I have following ant script to generate the jar file
<project name="myProject" basedir="." default="jar">
<property name="src" value="Java Source"/>
<property name="output" value="bin"/>
<target name="compile" depends="create">
<javac destdir="bin">
<src path="${src}"/>
<classpath refid="myProject.classpath"/>
</javac>
</target>
<target name="jar" depends="compile">
<jar destfile="myProject.jar">
<fileset dir="bin"/>
</jar>
</target>
<target name="clean">
<delete dir="${output}"/>
</target>
<target name="create" depends="clean">
<mkdir dir="${output}"/>
</target>
When I run ant script i get following error
Reference myProject.classpath not found.
I am not sure how to solve this error. It requires path of .classpath file ?
I also tried with
refid="classpath"
and it didnt work.
Can anyone help please!
Thanks
You need to define first something like because right now MyProject.classpath is not defined:
<classpath>
<pathelement path="${classpath}"/>
</classpath>
assuming that your classpath has what you need.
If it does not, create another entry under classpath element that has references to jars or whatever you need, or you need to custom specify path:
<path id="MyProject.classpath">
<pathelement location="lib/"/>
<pathelement path="${classpath}/"/>
<pathelement path="${additional.path}"/>
</path>
http://ant.apache.org/manual/using.html#path
I am new to ant, but am trying to create an ant script that builds my current proeject with another project as a dependency. I have the ant script building my current project, but am unsure how to add the other project to the classpath. Neither project get put into jar files at the moment.
My current portion of the build.xml file is
<target name="run" depends="compile">
<java classname="com.mypackage.Main">
<classpath>
<pathelement location="../project1/out"/>
<pathelement location="${bin}"/>
</classpath>
</java>
</target>
Thanks for your help!
I was able to do it using
<target name="run" depends="compile">
<java classname="com.mypackage.Main" fork="true">
<classpath>
<dirset dir="${other.dir}">
<include name="out/**"/>
</dirset>
<pathelement location="${bin}" />
</classpath>
</java>
</target>
Where ${other.dir} is the relative path to the root of the other project.