I'm trying to get Jasper Reports working from my app in VB.Net. So, after considering many options, I decided to create a small program in java to launch it, and reference it in my .Net project, using JNI4NET.
I don't know if I'm doing something wrong, but, when I launch the proxygen tool, it gives me a "OK/Completed" message, it creates two directories, java and csharp, with two files that I think are the two proxies.
The problem comes when I follow the Wiki instructions(https://github.com/jni4net/jni4net/wiki/Generating-Proxies) and there says that it should be a "build.cmd" file that creates the dll that will be included later in my project. I don't have that file. What am I missing?
I launched the proxy with the command line .\proxygen.exe ProxyGenJasperTest.xml, being the xml:
<?xml version="1.0" encoding="utf-8" ?>
<jni4net-proxygen xmlns="http://jni4net.sf.net/0.8.8.0/toolConfig.xsd">
<!-- Location where .java files will be generated into. It's relative or absolute path. -->
<TargetDirJvm>java</TargetDirJvm>
<!-- Location where .cs files will be generated into. It's relative or absolute path. -->
<TargetDirClr>csharp</TargetDirClr>
<!-- List of class paths (.jar files or directories) which define known classes for generator-->
<ClassPath Path="lib/com.springsource.com.informix.jdbc-3.0.0.JC3.jar"/>
<ClassPath Path="lib/commons-beanutils-1.9.2.jar"/>
<ClassPath Path="lib/commons-collections-3.2.2.jar"/>
<ClassPath Path="lib/commons-digester-2.1.jar"/>
<ClassPath Path="lib/commons-logging-1.2.jar"/>
<ClassPath Path="lib/ecj-4.3.1.jar"/>
<ClassPath Path="lib/groovy-all-2.4.5.jar"/>
<ClassPath Path="lib/itext-2.1.7.jar"/>
<ClassPath Path="lib/jasperreports-6.2.2.jar"/>
<ClassPath Path="lib/jasperreports-fonts-6.2.2.jar"/>
<ClassPath Path="lib/jasperreports-functions-6.2.2.jar"/>
<ClassPath Path="lib/jasperreports-javaflow-6.2.2"/>
<ClassPath Path="lib/joda-time-2.4.jar"/>
<ClassPath Path="lib/ojdbc6.jar"/>
<ClassPath Path="JasperTest.jar"/>
<!-- List of Java classes which should have proxy generated -->
<JavaClass TypeName="jaspertest.JasperTest"/>
</jni4net-proxygen>
XML vilely stolen from samples and changed.
Any help? Thanks.
Related
I have jar file having some properties files in it like log4j.properties and config.properties. Following is my ant script for yguard. Everything else is working but the properties file updation.
<target name="yguard">
<taskdef name="yguard" classname="com.yworks.yguard.YGuardTask" classpath="lib/yguard.jar" />
<yguard>
<inoutpairs resources="none">
<fileset dir="${basedir}">
<include name="MyApp.jar" />
</fileset>
<mapper type="glob" from="MyApp.jar" to="MyAppObs.jar" />
</inoutpairs>
<externalclasses>
<pathelement location="lib/log4j-1.2.17.jar" />
</externalclasses>
<rename conservemanifest="true" mainclass="com.amit.Application" >
<adjust replaceContent="true" >
<include name="**/*.properties" />
</adjust>
</rename>
</yguard>
</target>
config.properties file
com.amit.Application.param1 = something
I found some question in stackoverflow but they didn't help. One place it was mentioned that the file (like jsp, xml, properties) should be in the jar file which I already have. But my yguard obfuscated file just get the files copied as it is.
I tried many combinations with rename & adjust tags but nothing worked for me.
Following post I already visited
Is it possible to manage logs through Obfuscation with yGuard?
How to include obfuscated jar file into a war file
Apparently you want yGuard to obfuscate the name of the field param1, because com.amit.Application is obviously your entry point and yGuard excludes the given main class automatically. So basically you want the outcome to be something like
com.amit.Application.AÖÜF = something
This isn't possible, because yGuard can only adjust class names in property files, as state here: yGuard Manual
I'm rewriting build.xml file from Ant to Phing and everything goes fine with one exception.
I need to add new line at the end of each appended file but I can't find any alternative for fixlastline="true".
In Ant it was
<concat destfile="${libraryFilePrefix}.js" fixlastline="yes">
<!-- many filesets -->
</concat>
In Phing it's like
<append destfile="${libraryFilePrefix}.js">
<!-- many filesets -->
</append>
Is there any attribute that works like fixlastline or maybe I need to find another way to achieve this?
I believe, one of the approaches (and possibly the only one) is applying replaceregexp filter on each fileset. You only need to apply filterchain at the beginning and it will do the job for each fileset, like this:
<append destfile="${libraryFilePrefix}.js">
<filterchain>
<replaceregexp>
<regexp pattern="([^\n])$" replace="$1${line.separator}" ignoreCase="true"/>
</replaceregexp>
</filterchain>
<!-- many filesets -->
</append>
As of Phing 3.x the AppendTask is aware of the fixlastline attribute. Your Ant script provided is now working as expected
<project name="concat-supports-fixlastline" default="concat-fixed-lastline" basedir=".">
<target name="concat-fixed-lastline">
<concat destfile="${libraryFilePrefix}.js" fixlastline="yes">
<!-- many filesets -->
</concat>
</target>
</project>
I've recently been experimenting with an ANT script for setting up a small application (with various paths and other variables) using AntForm. AntForm has a file selector, but I would have to write something custom to validate the path (i.e., make sure it is the path to the thing that I asked the user for). I was wondering if anyone had experience with using using AntForm in this way. What I want is something like a Wizard page with a file selector, and when the user clicks "next" or when the file is selected some sort of a validation task is executed, and the wizard proceeds from there. The absolute best would be if I could gray out the "next" button or add an "invalid path" message, but that's getting a little complicated for what it seems that AntForm was designed for. Below is an example XML file to get started. Note that it expects AntForm.jar to be in the ./bin directory.
<?xml version="1.0"?>
<project name="My App Setup" default="getPath" basedir=".">
<property name="app.dir" value="${user.home}/appXYZ"/>
<path id="runtime.cp">
<pathelement location="bin/"/>
<fileset dir="lib" includes="antform.jar"/>
</path>
<taskdef name="antform" classname="com.sardak.antform.AntForm"
classpathref="runtime.cp"/>
<taskdef name="antmenu" classname="com.sardak.antform.AntMenu"
classpathref="runtime.cp"/>
<!-- test wizard behaviour, step 1 -->
<target name="getPath"
description="Check for App XYZ in path">
<antform title="Choose directory of app xyz"
lookAndFeel="com.sun.java.swing.plaf.windows.WindowsLookAndFeel"
okMessage="Next"
nextTarget="wizard2"
>
<fileSelectionProperty
label="App XYZ Distribution"
property="app.dir"
directoryChooser="true" />
<!-- TODO: how to validate and choose where to go from this form? -->
</antform>
</target>
<!-- test wizard behaviour, step 1 -->
<target name="wizard2"
description="continue setup">
<antform title="did we validate?"
lookAndFeel="com.sun.java.swing.plaf.windows.WindowsLookAndFeel"
okMessage="Finish"
previousTarget="getPath"
>
<label>Did we validate the path before we got here?</label>
</antform>
</target>
</project>
I am new to JaCoCo and trying to figure out why the html report that I am generating is not linked with my source.
The coverage numbers look correct and I can browse down to each class and then each method but I can not see the source. I have tried many different things inside the sourcefiles tag but nothing is working. Has anyone else had this issue? Here is a snippet of my ant script:
...
<test name="test.fw.UITestSuite" todir="${logdir}"/>
</junit>
</jacoco:coverage>
<fail if="TestFailed" status="1" message="UI junit test failure detected"/>
<echo message="${src}"/>
<jacoco:report>
<executiondata>
<file file="jacoco.exec"/>
</executiondata>
<structure name="UI">
<classfiles>
<fileset dir="${build}/fw"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="fw" includes="**./*.java"/>
</sourcefiles>
</structure>
<html destdir="report"/>
</jacoco:report>
</target>
...
Your fileset definition seems odd.
The include must be (the first . is misplaced):
includes="**/*.java
Try simply pointing it to the root of your src dir (there is no need for the includes)
<fileset dir="fw" />
But fw has to be the root of your sources, i.e. it contains the package folders like:
src
-org
-module
-MyClass1.java
-MyClass2.java
I’ve seen this break when using Scala-style package directory names, e.g.,
src/main/java/com.example.foo.bar/Foo.java
for fewer levels of nesting, faster autocompletion, &c., compared to the standard
src/main/java/com/example/foo/bar/Foo.java
Most tools support the first version just fine, but usually if you try it out and everything works fine, by the time you notice something like the jacoco reports not showing the source anymore, you’ve long forgotten the directory name change …
I'm a bit confused with the aspectpath option of the iajc compiler.
My project use AspectJ to weave metric code into an existing swing application.
All the application source are packaged this way:
com.xxx.yyy.myapp.*
We have put our aspect in a package inside the same project:
com.xxx.yyy.aop.*
The project is built with javac first and the outpout goes into ${classes.dir}.
Then we invoke iacj this way:
<iajc inpath="${classes.dir}"
destDir="${classes.dir}"
fork="true"
maxmem="${aspectj.maxmem}"
verbose="true"
showWeaveInfo="true"
debug="true"
source="1.6"
target="1.6">
<classpath refid="ajclasspath"/>
</iajc>
and
<path id="ajclasspath">
<path refid="classpath"/>
<pathelement location="${scm.home}/ant_libs/aspectjrt.jar"/>
</path>
With that said, do i need to specify an aspectpath in the iajc?
Regards
According to documentation similar to classpath, aspectpath contains read-only, binary aspect libraries that are woven into sources but not included in the output. In your case you include your aspects in output and they are in ${classes.dir} with normal classes.
So you don't have to specify aspectpath when you don't want to separate your aspects.