In Oxygen XML Editor, can I automatically xcopy a folder to my Transformation's output folder? - dita

I am using version 21 of the Oxygen XML Editor and the DITA Map WebHelp Classic (deprecated) Transformation Scenario. I have a folder that contains HTML files I want to open in a new window/tab, so that are xref'd in my XML file such as:
[<b><xref href="External/aFile.html" format="html" scope="external">Some Text</xref></b>]
I have a PostProcess batch script that I manually run that does an xcopy of the External folder to Oxygen's out/webhelp folder, and I would like to instead run it automatically in Oxygen after the Transformation is done. Is there I way I can do this?

Two ways:
1) Use your custom ANT build file in the Oxygen transformation scenario:
To use a custom build file in a DITA-OT transformation, follow these steps:
Use the Configure Transformation Scenario(s) action to open the Configure Transformation Scenario(s) dialog box.
Select the transformation scenario and click Edit.
Go to the Advanced tab and change the Custom build file path to point to the custom build file.
As an example, if you want to call a custom script before running the DITA OT, your custom build file would have the following content:
<project basedir="." default="dist">
<!--The DITA OT default build file-->
<import file="path/to/DITA-OT3.x/build.xml"/>
<target name="dist">
<!--Call the DITA OT default target-->
<antcall target="init"/>
<!-- You could run your script here -->
<!--<copy></copy>-->
</target>
</project>
2) Create your own DITA Open Toolkit plugin which adds a new transformation type with a custom ANT build file which calls the WebHelp transformation type and afterwards can perform the copy operation:
https://www.oxygenxml.com/doc/versions/21.1/ug-editor/topics/whr-xslt-customization.html

Related

Can I configure Dita-OT 2.1 to output only the topic.fo file and not the pdf

Is there a method when creating dita-ot 2.1 pipeline to only output the
topic.fo and not go on to create the PDF?
Regards
Conteh
As far as I know there is no such a parameter available by default.
If you look in the ANT build file "DITA-OT/plugins/org.dita.pdf2/build.xml" there is a "transform.fo2pdf" target. I guess you could manually make changes to the build file in order to avoid calling this target from the "transform.topic2pdf" target.
Change:
<target name="transform.topic2pdf" depends="copyCoreArtwork,transform.topic2fo,transform.fo2pdf"/>
To:
<target name="transform.topic2pdf" depends="copyCoreArtwork,transform.topic2fo"/>

Eclipse: Why is it eating my log4j.properties file?

Windows 7 Professional
Eclipse 3.7.2
I am migrating over to Eclipse from another IDE. I am compiling my project with the same ANT build.xml file I was using before. I do it by
highlighting my project in the project view
expanding the tree node
finding my build.xml file there
right clicking my build.xml file
choosing Run as > Ant Build
Works great, but every few builds Eclpise eats my log4j.properties file located at:
C:\AllProjects\Workspace\acme\war\WEB-INF\classes\log4j.properties
Eclipse basically eats all files in WEB-INF\classes that are not *.class files.
What am I doing to make this happen and how can I stop it?
Thanks
Since you're using ant instead of Eclipse to build, you could try turning off the setting to build the project automatically.
Select your project, then in the menu bar at the top of the screen, select Project and uncheck the Build Automatically option.
Edit: Second opinion
I would add an ant task to copy the log4j property file into your WEB-INF/classes folder every time you do a build. One nice advantage of this is that you can have a different property file for different build types (debug, release, etc.) and not worry about manually making changes to it. Also, this should make it easier to manage if you're using version control.
Copy your log4j.properties file to your source directory and add something like this to your ant build file:
<target name="copy-log4j-property-file">
<copy file="src/log4j.properties" todir="WEB-INF/classes" />
</target>
<target name="build" depends="copy-log4j-property-file">
<!-- the rest of your build things here -->
</target>
After selecting in Project explorer:
Properties > Java Compiler > Building > Output Folder
Uncheck "Scrub output folders when cleaning projects"
It is a solution for me ( though maybe not everyone ) because I use a time test ANT build.xml to do my compiling, building and cleaning for me. I just leave Eclipse's auto builds on so I get those nice error notifications as a I type, before I compile.

Call custom tool from TFS build

We are using TFS2010 for our web sites's builds and we're in the process of creating fully automated builds. At the moment the sites are built and deployed in remote servers.
The sites contains several configuration files that we would like to transform as part of the build. As there are some rules to create the correct config files we would like to use a custom tool for that purpose (.exe), not to use xml transformations for it.
From what we can see in the build template, MSBuild copies the files to a drop folder and then pushes them to the remote IIS site. We would like to hook our custom tool to this process and do the transformations in the build server before the site is published. The problem is that the MSBuild task is a single node in the build template and we can't find a place where to invoke our tool. Before the MSBuild step, there is no code deployed to the drop folder, after the MSBuild step the code was already deployed to the remote server.
Any ideas on how to plug the custom tool in the correct workflow step?
What is the msbuild target, that you use? I think you can define your own target in csproj file to do the following:
execute your custom tool against required files
run usual build target (or whatever target you normally use)
Edit
E.g. in a .csproj file you could define the following:
<Target Name="buildWithCustomTool">
<!-- Exec your custom tool -->
<Exec Command="your command" />
<!-- Call the build target which will run as normally -->
<CallTarget Targets="Build" />
</Target>
Hope it helps,
Ivan

Changing dafault Netbeans Platform

Im developing application on top of Netbeans Platform.
In NetBeans IDE it is possible to choose different Netbeans Platform (it can be added under
NetBeans Platform Manager), but i cant find option/property to change default selection.
Is this even supported on Netbeans IDE?
I can't see a way to do this using the default ant based system. However if you use the maven based approach then it is a simple as editing the pom.xml
Solution for ANT based Nb Platform application is to modify ant build file to create custom properties before building application (separate modules). In this solution I create new properties file and fix the pointer in platform properties file to point to it. This file is later imported before building each module.
1) Create/Modify platform-private.properties to set user.properties.file to your custom one (i.e nbproject/private/build.properties). This file is later used to configure properties when building separate modules.
2) Create new user.properties.file (build.properties) and set nbplatform.default.harness.dir and nbplatform.default.netbeans.dest.dir to correct values (those parameters points to folder where nb platform is located - in my case it is located in project basedir under ./nbrc folder)
<project name="..." basedir=".">
<!-- Basedir property must be converted to use forward slashes (for windows machines) -->
<path id="basedir.path">
<pathelement path="${basedir}" />
</path>
<pathconvert targetos="unix" property="basedir.unix" refid="basedir.path"/>
<!-- Initialize path to netbeans platform [located in nbrc folder in project root directory -->
<mkdir dir="nbproject/private"/>
<echo file="nbproject/private/platform-private.properties">user.properties.file=${basedir.unix}/nbproject/private/build.properties${line.separator}</echo>
<echo file="nbproject/private/build.properties">nbplatform.default.harness.dir=${nbplatform.default.netbeans.dest.dir}/harness${line.separator}</echo>
<echo file="nbproject/private/build.properties" append="true">nbplatform.default.netbeans.dest.dir=${basedir.unix}/nbrc${line.separator} </echo>
<!-- .. -->
</project> `

How to include a resource file in the Jar file generated by Netbeans?

I'm using NB6.7 to auto generate an executable jar file for my project, how and where to tell NB to include a certain resource into the result jar file ? I know if I put the resource in the "lib" directory, NB will put it into "dist/lib/", but what I want is to include the resource within the final executable jar, where in NB do I specify that ?
Frank
There is a way to add arbitrary file/folders to arbitrary location within the jar, without setting up source folders.
NetBeans will, by default, create build.xml at project root.
We can override the -pre-jar target to copy the files and -post-jar target to cleanup.
For example, to copy "res/resource.ext" into "myres/resource.ext" within the jar, add these target to build.xml:
<target name="-pre-jar">
<!-- Single file -->
<copy file="res/resoure.ext" todir="${build.dir}/classes/myres" />
<!-- Folder(s) -->
<copy todir="${build.dir}/classes/myres"><fileset dir="res"/></copy>
</target>
<target name="-post-jar">
<delete dir="${build.dir}/classes/myres/resource.ext" />
<delete dir="${build.dir}/classes/myres"/>
</target>
Since this is Ant, you have great control.
You can rename file, replace file content (e.g. update version or timestamp), convert charset, or run other operations that is not possible with simple inclusion.
I am using NetBeans version 8, but as long as the project is compatible it is likely to work.
Alternatively, use an automated project such as Maven or Gradle, that gives you even more control on the build process, at cost of IDE features such as automatic single file recompile.
I got it : put the resource file in the src dir.
you can do it by...
Go to your project name which is normally on the left hand side of the screen.
Whatever your project name is,
you have to right click on it and then go to the properties of that. [which is normally at the end in menu item]
Then one window will open in that go to the Libraries.
In that you will find
1)ADD PROJECT
2)ADD Libraries
3)ADD JAR FILE
then include the jar / Libraries / folder.
so that will add automatically to your project.
Which will include in lib folder automatically so you don't have to include always.
Hope this help you,