Apache Ant JAR Task: not finding properties - spring

How exactly should I specify the location of all the properties files inside the ant manifest?
My jar is not working because it can't find the log4j, Spring, etc properties.
These files are all contained within a folder called "server-config" that sits at the same level as the source code, ie:
META-INF
com
server-config
Essentially, I want to know what I need to add to the Class-Path property for the jar to be aware of all these properties files inside the server-config folder.
Here's my current task:
<jar destfile="${root.home}/onejar/build/main/main.jar" basedir="${build.home}">
<manifest>
<attribute name="Class-Path" value=".;server-config" />
</manifest>
<include name="com/mycompany/client/*"/>
<include name="com/mycompany/portable/util/*"/>
<include name="com/mycompany/request/*"/>
<include name="com/mycompany/model/*"/>
<include name="com/mycompany/controller/*"/>
<include name="com/mycompany/helpers/*"/>
<include name="server-config/*"/>
</jar>
I've tried a few things and none of them are working, I keep on getting errors due to the file not being found.
Any help would be greatly appreciated!

You can remove the entire <manifest... part - that's not what the Class-Path manifest attribute does. It's for things external to the JAR.
The line <include name="server-config/*"/> should work - if the server-config directory exists inside your ${build.home} directory. You probably need a task to copy them there - you mention that the source code sits at the same level, but you don't mention where they are compiled to.
An example -
<mkdir dir="${build.dir}/server-config"
<copy todir="${build.dir}/server-config">
<fileset dir="${src.dir}/server-config">
<include name="*"/>
</fileset>
</copy>

Related

How to install updates on Progress-4GL programs

Good afternoon,
In my company, we are regularly doing updates on customers' systems, all Progress-4GL technology. Currently we are doing all this manually, and I'd like to automate this.
The following actions are needed:
Take a dump (*.df) of the current database
Upload modifications to the database (*.df files)
compile *.w and *.p files.
Is there a tool that does all that (together with zipping/unzipping *.w, *.p and *.i files), or do I need to create such a tool myself?
In the latter case, what are the commandline commands for the mentioned actions:
Take a dump (*.df) of the current database
Upload modifications to the database (*.df files)
compile *.w and *.p files.
If you're familiar with ANT, the take a look at the PCT plugin for ANT:
https://github.com/Riverside-Software/pct
This makes is easy to create a delta.df file between the "new" full DF and the current database, e.g.:
<PCTDumpIncremental destFile="temp/delta.df" dlcHome="${dlc}"
debugLevel="2" activeIndexes="0" removeEmptyDFFile="true" msgBufferSize="${Mm}" >
<SourceDB dbname="temp/ref-SmartDB" singleUser="true" />
<TargetDB dbname="${smartdb}" dbDir="${smartdbdir}" singleUser="${smartdbsingleuser}"/>
</PCTDumpIncremental>
and then load the delta.df into the current application DB:
<PCTLoadSchema srcFile="temp/delta.df" dlcHome="${dlc}" onlineChanges="true" callbackClass="rssw.pct.AbstractLoadCallback" msgBufferSize="${Mm}" commitWhenErrors="false">
<DBConnectionSet refid="smartdbset" />
</PCTLoadSchema>
and then compile the application:
<PCTCompile destDir="${installroot}" graphicalMode="true" dlcHome="${dlc}"
md5="true" minSize="false" cpinternal="${cpinternal}" cpColl="${cpcoll}" cpstream="${cpstream}"
compileUnderscore="true" inputchars="32000" baseDir="${installroot}"
token="4000" progPerc="10" assemblies="${assemblies}">
<fileset dir="${installroot}" casesensitive="false">
<include name="Ccs/**/*.cls"/>
<include name="Consultingwerk/**/*.cls"/>
<include name="Consultingwerk/**/*.p"/>
<include name="Consultingwerk/**/*.w"/>
<include name="Setup/**/*.p"/>
<include name="src/**/*.p"/>
</fileset>
<propath>
<pathelement path="${installroot}/." />
<pathelement path="${installroot}/src" />
<pathelement path="${installroot}/Consultingwerk/Studio/ProdictDumpHack/src" />
<pathelement path="${dlc}/gui/netlib/OpenEdge.Net.pl" />
</propath>
<DBConnectionSet refid="smartdbset" />
</PCTCompile>
ANT and PCT are included in OpenEdge from 11.7 on. Since you're on 11.6, you'll have to bring your own ANT and PCT.

create executable jar including external jar file from Netbeans 8.0.2 and java 8

I want to create executable jar file which includes my external jar files,
I am using Netbeans 8.0.2 and Java 8
I tried updating build.xml using solution provided on internet and stackoverflow,
But external jars files are not getting included into my single executable jar file.
I have tried this too
<target name="package-for-store" depends="jar">
<property name="store.jar.name" value="myProject"/>
<property name="store.dir" value="store"/>
<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
<echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
<delete dir="${store.dir}"/>
<mkdir dir="${store.dir}"/>
<jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
<zipgroupfileset dir="dist" includes="*.jar"/>
<zipgroupfileset dir="dist/lib" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
<zip destfile="${store.jar}">
<zipfileset src="${store.dir}/temp_final.jar"
excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
</zip>
<delete file="${store.dir}/temp_final.jar"/>
</target>
I have also tried this
How to build a fat jar using Netbeans
it created a single jar file but it doesn't include my external dependency.
Can anyone help me on how can I include my external jars into single executable jar using Netbeans 8.0.2 and java8
I have finally found the answer,
I used below configuration in build.xml
<target name="package-for-store" depends="jar">
<property name="store.jar.name" value="DocumentProtector"/>
<property name="store.dir" value="store"/>
<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
<echo message="Packaging ${application.title} into a single JAR at ${store.jar} mainclass ${main.class}"/>
<delete dir="${store.dir}"/>
<mkdir dir="${store.dir}"/>
<jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
<zipgroupfileset dir="dist" includes="*.jar"/>
<zipgroupfileset dir="dist/lib" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
<zip destfile="${store.jar}">
<zipfileset src="${store.dir}/temp_final.jar"
excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
</zip>
<delete file="${store.dir}/temp_final.jar"/>
</target>
after clean+build
right click build.xml and goto Other target and click on package-for-store
but after doing this I was getting wrong main class
so after little research i found the solution to change main class
go to project folder -> nbproject and open project.properties file
and change main.class to you mail class file name with package name
like this main.class=com.test.package.MainClass
and clean+build and again
right click build.xml and goto Other target and click on package-for-store

Maven regular expression to match file is not working

I have two files test-200-12-30-2990 and test-project-200-12-30-2990 I am unziping it to corresponding folders. Second task is not working. I want to select the file 'test-200-12-30-2990'
Below is the ant build.xml. I am using maven ant plugin inside pom
<mkdir dir="/testdir"/>
<unzip dest="src/main/resources/testdir">
<fileset dir="src/main/resources">
<include name="**/test-project*.zip"/>
</fileset>
</unzip>
</target>
<mkdir dir="/test-projectdir"/>
<unzip dest="src/main/resources/test-projectdir">
<fileset dir="src/main/resources">
<include name="**/test[1-9].zip"/>
</fileset>
</unzip>
</target>
I'm not quite sure how inclusion might work in Maven, but maybe we could solve this problem with a simple expression that you already have, something maybe similar to:
test-[0-9-]+
Then, the include might look like:
test-[0-9-]+\.zip
**/test-[0-9-]+\.zip
If escaping . might be unnecessary, then we can just use:
**/test-[0-9-]+.zip
DEMO
Reference
Include xml files in maven project

srcdir attributes must be set

Im trying to migrate my code from ant to gradle and imported my build.xml in build.gradle and some of my tasks work fine.
However there are some tasks when i run them it says
Execution failed for task ':compile'.
srcdir attribute must be set!
Pasting a snippet of my Build.xml and the compile task below is failing.
<project basedir="." default="deploy" name="FitNesse">
<property name="fitnesse.target" value="/build/test-fitnesse"/>
<patternset id="test.patternset">
<include name="**/*Test*.java"/>
</patternset>
<propertyset id="test.propertyset">
<propertyref name="basedir"/>
<propertyref name="test.patternset"/>
</propertyset>
<fileset id="classpath.fitnesse" dir="./libs">
<include name="antlr-2.7.7.jar"/>
<include name="asm-4.1.jar"/>
<include name="asm-analysis-4.1.jar"/>
<include name="asm-commons-4.1.jar"/>
<include name="asm-tree-4.1.jar"/
><target name="compile" description="Compile java sources" depends="clean">
<mkdir dir="build/classes"/>
<javac includeantruntime="false"/>
<javac srcdir="src/main/java" destdir="build/classes" debug="on">
<classpath refid="classpath.compile"/>
<compilerarg value="-processorpath"/>
<compilerarg value="-AmethodConstraintsSupported=true"/>
</javac>
</target>
Source folder structure
/src/main/java/com/xebia/inc/xeb
I had changed my src folder structure from ant "src" to a gradle project "/src/main/java/com/xebia/incubator/xebium". and lib folder to libs
Please help. I'm kind of novice to this.
Thanks,
The full error message should give you the line number and it's most probably the line that contains
<javac includeantruntime="false"/>
which looks like a copy-paste error.

How to create sitemap.xml from docbook source

I need to generate sitemap.xml in the standard Google acceptable format from my docbook source. I'm currently using gradle to power the build process.
Is there an existing tool out there to generate sitemap.xml automatically as part of the build?
By Using Ant from Gradle is seams to be possible as there is an Apache Ant Task for generating a XML Sitemap. Read the manual at GitHub, for the usage details.
<target name="generate_sitemap" description="generates the sitemap">
<taskdef classname="uk.co.arjones.ant.task.Sitemap" name="sitemap"></taskdef>
<sitemap url="http://organisation.org" gzip="yes" lastmod="now" destdir="${BUILD_DIR}">
<fileset dir="${BUILD_DIR}">
<include name="**.docbook"></include>
<include name="**.dbx"></include>
<exclude name="google*"></exclude>
</fileset>
</sitemap>
</target>

Resources