I am just moving to Kodo JPA version 4.2 and it isn't going smoothly.
when I run my any build script (in eclipse 3.4.1) I get
BUILD FAILED
D:\My Documents\eclipseWorkspaces\cnmp e341\blue ebig\ebig\src\java\build.xml:91: <openjpa-1.1.0-r422266:657916 fatal user error> org.apache.openjpa.util.MetaDataException: MetaDataFactory could not be configured (conf.newMetaDataFactoryInstance() returned null). This might mean that no configuration properties were found. Ensure that you have a META-INF/persistence.xml file, that it is available in your classpath, or that the properties file you are using for configuration is available. If you are using Ant, please see the <properties> or <propertiesFile> attributes of the task's nested <config> element. This can also occur if your OpenJPA distribution jars are corrupt, or if your security policy is overly strict.
My build.xml is sitting in my java directory next to my META-INF directory containing my persistence.xml file
here is the snippet from the build.xml
<target name="enhance">
<echo>base dir is ${basedir}</echo>
<!-- define the kodoc task; this can be done at the top of the -->
<!-- build.xml file, so it will be available for all targets -->
<taskdef name="kodoc" classname="kodo.ant.PCEnhancerTask"/>
<!-- invoke enhancer on all .jdo files below the current directory -->
<kodoc>
<fileset dir=".">
<include name="**/jpa/*.java" />
<include name="**/jpa/*.class" />
</fileset>
<classpath>
<pathelement location="${basedir}"/>
</classpath>
</kodoc>
</target>
The entity class files are in the jpa directory. So the directory structure looks like this:
+ top
+ src
+ java
| + com
| + splat
| | + jpa
| | - entity.java
| | + stuff
| - Object.java
| + META-INF
| - persistence.xml
- build.xml
I had thought I had followed the directions in the doc., but clearly I didn't.
Thanks
This problem was fixed by adding config propertiesFile="../../config/ebig.kodo.properties"/>
to the task it now looks like
<kodoc>
<config propertiesFile="../../config/ebig.kodo.properties"/>
<fileset dir=".">
<include name="**/jpa/*.java" />
<include name="**/jpa/*.class" />
</fileset>
<classpath>
<pathelement location="${basedir}"/>
</classpath>
</kodoc>
Related
I am trying to generate a build script for a plugin outside the IDE
Below is mybuild.xml
<project name="com.foo.poo" xmlns='antlib:org.apache.tools.ant'>
<target name="build.plugin">
<antcall target="generateBuildScript" />
<ant dir="${workspace.dir}/${project.name}"
antfile="build.xml"
target="build.update.jar" />
<copy todir="${eclipse.dir}/plugins">
<fileset dir="${workspace.dir}/${project.name}">
<include name="*.jar"/>
</fileset>
</copy>
</target>
<target name="generateBuildScript">
<eclipse.buildScript elements="plugin#${project.name}"
buildDirectory="${workspace.dir}"
baseLocation="${eclipse.dir}"
configInfo="linux,gtk,win32,win32,x86"/>
</target>
</project>
Expecting build.xml to be generated Please Guide me
When I run above script
$java -jar {$Eclipse.Dir}/plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar -application org.eclipse.ant.core.antRunner -buildfile <Project_path>\mybuild.xml
I nothing is happening on build success.
Here i have found the answer may help some new bees like me..
<project name="com.foo.poo" xmlns='antlib:org.apache.tools.ant'>
...
</project>
As there is no default set, it is not generating the required jar file so
modified only the first line as
<project name="com.foo.poo" default="build.plugin" xmlns='antlib:org.apache.tools.ant'>
...
</project>
now the required jar is generated under plugin folder and even copied to plugin folder of eclipse.
baseLocation : Target Plugins Directory absolute path.
buildDirectory: Absolute path to the plugin folder in which the Plugin Project is present.
In netBeans 8.2, I'm having an issue reading groovy inside a build.xml file.
I have a project in which I run my script via a build.xml using the build-in Ant 1.9.7.
In it, for my groovy task, I set the following:
<property environment="env" />
<path id="groovy.classpath">
<fileset dir="${env.GROOVY_HOME}/embeddable" />
</path>
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="groovy.classpath" />
For environment variable {env.GROOVY_HOME}, I have set the following in windows environment variable:
GROOVY_HOME with the value C:\Program Files (x86)\Groovy\Groovy-2.4.10
Yet I'm still having an error ""Script failed" when reaching the step with Groovy at the following stage in the build.xml file:
<groovy>
def corePlatformList = []
[Groovy code here...]
</groovy>
I know the script is working fine as it does run perfectly in Eclipse and IntelliJ.
It would seem ant can't link with Groovy 2.4.10 for some reason.
I believe that you have some trivial error.
You need to include the library file.
Change from:
<path id="groovy.classpath">
<fileset dir="${env.GROOVY_HOME}/embeddable" />
</path>
To:
<path id="groovy.classpath">
<fileset dir="${env.GROOVY_HOME}/embeddable">
<include name="**/groovy-all-*.jar"/>
</fileset>
</path>
EDIT: based on OP comments
Here is the complete build.xml and I can see it working.
<project name="MyProject" default="runscript" basedir=".">
<path id="groovy.classpath">
<fileset dir="d:/softwares/groovy-2.4.5/embeddable">
<include name="**/groovy-all-*.jar"/>
</fileset>
</path>
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="groovy.classpath" />
<target name="runscript"
description="compile the source">
<groovy>
def corePlatformList = [1,2,3,4]
println corePlatformList
</groovy>
</target>
</project>
I have unjar ant task like below that was working until I changed classpath to include one more jar file. Wondering what the trick is to unjar every jar listed in javac.classpath. Basically it is breaking once javac.classpath has more than one jar file. I am Ant newbee. I am trying to figure out a way to enumerate every jar in javac.classpath and unjar it to build.classes.dir folder.
<unjar dest="${build.classes.dir}">
<fileset file="${javac.classpath}" >
</fileset>
</unjar>
if javac.classpath points to a folder then
<unjar dest="${build.classes.dir}">
<fileset dir="${javac.classpath}" >
</fileset>
</unjar>
will unjar all jar files in that folder.
if javac.classpath is a comma/semicolon separated list of file paths then you should change script a little bit to use filesets instead, like;
<?xml version="1.0" encoding="UTF-8"?>
<project name="Un-jar Demo" default="un-jar">
<fileset id="javac.classpath" dir="/path/to/jar/folder">
<include name="jar-file-1.jar" />
<include name="jar-file-2.jar" />
</fileset>
<target name="un-jar">
<unjar dest="test">
<fileset refid="javac.classpath">
</fileset>
</unjar>
</target>
</project>
of course, you can find some other ways to convert comma seperated list of files to a fileset
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>
I have web project in which I am using OpenJAP for database connectivity. I have configured the persistence.xml and I am able to connect to the database and retrieve the data. But in the console output I am seeing this entry
1953 OpenJPA TRACE [main] openjpa.jdbc.SQL - <t 31156635, conn 6888942> executing prepstmnt 9690924
UPDATE student
SET scourse = ?, sname = ?, sroll = ?
WHERE id = ?
[params=?, ?, ?, ?]
In my whole project till now I have not added any prepared statement or any update statement. I want to know why is OpenJPA executing this statement and what would be performance implication when I am fetching big data in the range of millions?
I have added following code to my build.xml file
<!-- ***************************************************************************************************************** -->
<!-- DO NOT DELETE FOLLOWING CODE. THIS IS ADDED FOR ENCHANCING THE CLASSES AT COMPILE TIME. IT IS REQUIRED BY OPENJPA -->
<!-- Define the classpath to include the necessary files. -->
<!-- ex. openjpa jars, persistence.xml, orm.xml, and target classes -->
<path id="jpa.enhancement.classpath">
<!-- Assuming persistence.xml/orm.xml are in WebContent/WEB-INF/classes/META-INF -->
<pathelement location="WebContent/WEB-INF/classes" />
<!-- Location of the .class files -->
<pathelement location="build/classes" />
<!-- Add the openjpa jars -->
<fileset dir=".">
<include name="**/lib/*.jar" />
</fileset>
</path>
<!-- define the openjpac task; this can be done at the top of the -->
<!-- build.xml file, so it will be available for all targets -->
<taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="jpa.enhancement.classpath" />
<!-- invoke enhancer on all .class files below the model directory -->
<openjpac>
<classpath refid="jpa.enhancement.classpath" />
<fileset dir=".">
<include name="**/model/*.class" />
</fileset>
</openjpac>
<echo message="Enhancement complete" />
<!-- ***************************************************************************************************************** -->
On adding this and setting the eclipse to use this build.xml file to create the WAR file. The objects are getting enhanced and I am not getting the "Executing the prepared statement" Trace in my log also it is not executing the extra "Update" statement.