ATG RunAssembler does not package weblogic-application.xml - weblogic12c

I am using ATG 11.1 with Weblogic 12c.
I have some configuration for inside /META-INF/weblogic-application.xml. For some reason runAssembler does not copy this xml over to the final ATG.ear in both in both standalone and non-standalone/development mode?
Also the runAssembler creats a jboss-app.xml inside the META-INF but not weblogic-application.xml
Thanks
Vivek

The weblogic-application.xml is not copied by the runAssembler script but rather generated. This means that if you want to modify the weblogic-application.xml you will need to do so after the runAssembler has completed. If you were using ant to do your builds you could implement something like this:
<macrodef name="enable-weblogic-appplication-setting">
<attribute name="earname" />
<sequential>
<available file="${ear.unpacked.dir}/${project.name}.ear/META-INF/weblogic-application.xml" property="weblogic-application.xml.found" />
<if>
<isset property="weblogic-application.xml.found" />
<then>
<replace file="${ear.unpacked.dir}/${project.name}.ear/META-INF/weblogic-application.xml">
<replacetoken>SomeStringThatWillAlwaysBeInTheFile</replacetoken>
<replacevalue>SomeStringThatWillAlwaysBeInTheFile plus TheNewValueYouWantToAdd</replacevalue>
</replace>
</then>
</if>
</sequential>
</macrodef>
I've been using this approach to dynamically update elements in the web.xml during the assembly process.
Alternatively, if you want to use your from source code weblogic-application.xml you can also use the ant script for <copy file='....' tofile='...' />.
As far as the weblogic-application.xml not being created by the runAssembler script, this is likely due to you not selecting the correct Application Server during the installation process of ATG.

Related

CruiseControl.net, send dynamic values to some files

I have been searching for a few days, I have also asked a question on the cc.net forum, but still don't have the answer.
My task is to fill Web.config with specific values during the building using cc.net. Here is the example:
I'm developing an ASP.NET website, I have a Web.config with some configuration, e.g. connection string:
<add name="ContextName" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=DatabaseName;User Id = UserName;Password=UserPassword;" providerName="System.Data.SqlClient" />
After the building I want to replace some values and make the config look like this:
<add name="ContextName" connectionString="Data Source=%SERVER%;Initial Catalog=%DATABASE%;User Id = %USER%;Password=%PASSWORD%;" providerName="System.Data.SqlClient" />
I tried this solution, but it didn't help me (or maybe I didn't understand how to use it properly).
Please help me to solve the task.
Thanks!
You can try to use this Config Transformation Tool which is XDT transformation command tool based on XDT (web.config) transform engine, which allows you to run XDT transformation on any XML files. You can use ccnet's task block to run it after your msbuild
<tasks>
<exec>
</exec>
</tasks>
More on ccnet executable task see here.
For more information on XDT transformation see this link in MSDN library
You can create a target on your build file to update the web.config and call that target after the build. I use something similar in my build files, here is an example:
<target name="update-config" >
<property name="export.config" value="" unless="${property::exists('export.config')}" />
<call target="${config-settings}" /> <!-- test or stage -->
<xmlpoke file="${export.config}" xpath="/configuration/appSettings/add[#key='ContextName']/#connectionString" value="${configValue.connectionString}" failonerror="true" />
</target>
<target name="test">
<property name="configValue.connectionString" value="test connection string here" />
</target>
<target name="stage">
<property name="configValue.connectionString" value="stage connection string here" />
</target>
After executing the target that compile your code and export you can run the target update-config, in this case I'm expecting a variable export.config with the path of the exported web.config then calling another target that sets the the value of the connectionstring variable (this can be target test or stage) and finally xmlpoke the web.config with the value.
Hope this helps!

Automate jar export across projects in eclipse

I have a Google Web Toolkit project for which i include a second project into the build path. This other project has a lot of my commonly used functions and classes. Building the project works fine but to avoid run time errors i have to jar the second project into the WAR folder of the GAE project.
The process of jar/exporting the second project into the first is a manual process that i do with a right click in eclipse.
Is there a way to automate the process of jar/exporting to WAR of the second project into a location on the first?
Would i do this with an ANT script?
Or is there a way this can be done within Eclipse itself.
Thanks for you help
You are in for some reading mate :)
Step 1 : Create a JAR of the first project ( Read this). In the jar task you could put as the path of your GAE's folder lib as the destfile like so :
<target name="jar">
<jar basedir="bin" destfile="../GAE_PROJECT/war/WEB-INF/lib/${project-name}.jar">
<manifest>
<attribute name="Built-By" value="${builder}" />
<attribute name="Built-On" value="${build-info.current-date}" />
<attribute name="Built-At" value="${build-info.current-time}" />
</manifest>
</jar>
</target>
Step 2 : Create the WAR for your GAE project ( Read the official documentation here ). The documentation shows how the jars in the lib are included :
<fileset dir="war/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>

NAnt ignoring property in included build file

I'm trying to make my project build file include a local build file, to allow for some customization for each developer, without having to keep exclulding the build file from version control commits etc.
But NAnt keeps ignoring the properties in my included build file, and not overwriting the properties set in the global build file.
For demo purposes this short build file behaves the same:
<project name="FooProject" default="showme" basedir="." >
<description>Foo</description>
<!-- Overwrite this property in local.build -->
<property name="database.connectionstring" overwrite="true" readonly="false" value="foo" />
<include buildfile="local.build" failonerror="true" verbose="true" />
<target name="showme" description="Show connectionstring variable">
<echo message="Connectionstring: ${database.connectionstring}" />
</target>
</project>
-and my local.build file looks like this:
<property name="database.connectionstring" value="bar" />
The expected output when running NAnt with this build file is "Connectionstring: bar", but the resulit is "Connectionstring: foo", no matter which combination of readonly and overwrite I try.
It does fail if I rename the file to something else, so NAnt is aware of the included file.
NAnt is v0.91 alpha.
Am I overlooking something or is NAnt not supposed to work like I expect?
It seems you should still wrap the contents of the included build file inside a project-element. Like so:
<project>
<property name="database.connectionstring" value="bar" />
</project>
When I did that the connectionstring was "bar".
Granted: I use Nant 0.91 final.

Netbeans manifest

Is it possible to add entries to the manifest.mf file of jars generated by netbeans?
to build an osgi bundle for instance.
Note that you can create a manifest on-the-fly via an ant task and set properties dynamically.
First, you must update your Netbeans "project.properties" file found in the "nbproject" directory. Add the following line to the file:
manifest.file=manifest.mf
Next, create an ant task to create/update the manifest using the "build.xml" file. In this example, we will set the version number and date of the jar file.
<target name="-pre-init">
<property name="project.name" value="My Library" />
<property name="version.num" value="1.4.1" />
<tstamp>
<format property="NOW" pattern="yyyy-MM-dd HH:mm:ss z" />
</tstamp>
<!--
<exec outputproperty="svna.version" executable="svnversion">
<arg value="-c" />
<redirector>
<outputfilterchain>
<tokenfilter>
<replaceregex pattern="^[0-9]*:?" replace="" flags="g"/>
<replaceregex pattern="M" replace="" flags="g"/>
</tokenfilter>
</outputfilterchain>
</redirector>
</exec>
-->
<manifest file="MANIFEST.MF">
<attribute name="Bundle-Name" value="${project.name}" />
<attribute name="Bundle-Version" value="${version.num}" />
<attribute name="Bundle-Date" value="${NOW}" />
<!--<attribute name="Bundle-Revision" value="${svna.version}" />-->
<attribute name="Implementation-Title" value="${project.name}" />
<attribute name="Implementation-Version" value="${version.num}" />
<attribute name="Implementation-URL" value="http://www.example.com" />
</manifest>
</target>
This will create a manifest file in your netbeans project directory and stuff it into your jar file. If you want to delete the autogenerated manifest file from your netbeans project directory, simply create another ant task (post jar of course):
<target name="-post-jar">
<delete file="MANIFEST.MF"/>
</target>
Interesting information might be here:
http://wiki.netbeans.org/FaqNoMainClass
I have a Java Class Library project with a custom manifest file - perfect for an OSGI bundle. To get this working first edit project.properties and set:
manifest.file=manifest.mf
manifest.available=true
Create your own custom manifest.mf file in the project directory.
(At this point if you try a clean/build you still won't get your custom manifest file - NetBeans will provide its own. This is because the build-impl.xml Ant target "-do-jar-with-libraries-without-manifest" is being called immediately after "-do-jar-with-manifest", overwriting your custom manifest JAR file with a default NetBeans manifest JAR.)
Add a custom target to your build.xml file as follows:
<target name="-do-jar-with-libraries-without-manifest">
<!-- Inserted to prevent target from running so we can have a custom
manifest file with a class library project type. -->
</target>
Tested in NetBeans 6.7.1
in the same dir as the build.xml
you can put your manifest.mf file
I'm using Netbeans 6.7.1
Turns out that the build-imp.xml (the actual build script Netbeans uses)
doesn't have a target which runs if 'with manifest, without main-class'
but it does have one like 'with manifest, with main-class'
So.. make sure you have the project-properties,run,main-Class filled with -anything-
i think that's some undocumented feature :(
this is my manifest content:
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
Bundle-ManifestVersion: 2
Bundle-Name: jinstall
Bundle-SymbolicName: jinstall
Import-Package: ( .... )
Export-Package: ( .... )
Bundle-Activator: ( ..... )
In case you using maven (nbm-maven-plugin), look at this
NBM Maven plugin
Why not using the a maven project, which worked well for me? E.g. apache felix
See this pluggable Swing example which I created in netbeans.
You can edit the nbproject/build-impl.xml adding the necessary properties like this:
....
<target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass">
<manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update">
<attribute name="Main-Class" value="${main.class}"/>
<attribute name="Property1" value="foo"/>
<attribute name="Property2" value="bar"/>
</manifest>
</target>
....
This will result in a MANIFEST.MF in jar file like this:
Manifest-Version: 1.0
...
Property1: foo
Property2: bar
Tested on Netbeans 8.1.
See this article.
Here it is described how to
create own ant targets
add manual entries to manifest.mf for the output JAR
run custom ant targets from Netbeans

How can I automate compiling a large Java project?

I'm working on an automation project for my employer. We have a pool for each revision of our source code. When you download a revision, you need to create a directory structure with a bunch of third party includes to eventually build the project. I've automated this entire process up to the point of having my script (.bat) compile each particular runnable java application. There are many applications to this single project, and the directory listing looks something like this:
Proj Name
-variousincludesfolder1
-variousincludesfolder2
-variousincludesfolder3
-variousincludesfolder4
-runnableapplicationsandmoreincludes
-con.java
Right now, I'd like to do an automated compiling of con.java, but I don't know where to begin. People have suggested I try Ant, but any automated Ant file generation I get using Eclipse seems only enough to build con.java while an active project file exists. Is there anyway to automate this without using eclipse, to the point of having the batch file generate a .jar itself?
This is definitely a job for Ant. Don't rely on Eclipse-generated Ant files; read through the manual and write one yourself. (You'll likely find out that Ant does things you didn't think of doing in your build script, too.)
To be more specific, here is the documentation for the jar task.
You can define wildcard and pattern matches to include/exclude all sorts of files and folders in your build. Take a look at the Ant manual to see how things like filesets work with include and exclude filters.
Also, read the tutorial.
Here is a simple build file that looks to compile all java files and reference all jars. Place it in the top level directory:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl"
href="http://www.ibm.com/developerworks/xml/library/x-antxsl/examples/example2/ant2html.xsl"?>
<project name="Proj Name" default="build" basedir=".">
<property name="src.dir" value="${basedir}" description="base folder where the source files will be found. Typically under /src, but could be anywhere. Defaulting to root directory of the project" />
<property name="build.dir" value="build" description="Where to put build files, separate from src and resource files." />
<path id="master-classpath">
<fileset dir="${basedir}" description="looks for any jar file under the root directory">
<include name="**/*.jar" />
</fileset>
</path>
<target name="build" description="Compile all JAVA files in the project">
<javac srcdir="${src.dir}"
destdir="${build.dir}/classes"
debug="true"
deprecation="true"
verbose="false"
optimize="false"
failonerror="true">
<!--master-classpath is defined above to include any jar files in the project subdirectories(can be customized to include/exclude)-->
<classpath refid="master-classpath"/>
<!--If you want to define a pattern of files/folders to exclude from compilation...-->
<exclude name="**/realm/**"/>
</javac>
</target>
</project>