alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (build.xml)

This example Java source code file (build.xml) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

and, any, build_date, copyright, generate, iiop, including, rmi, the

The build.xml Java example source code

<!--
 Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:

   - Redistributions of source code must retain the above copyright
     notice, this list of conditions and the following disclaimer.

   - Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.

   - Neither the name of Oracle nor the names of its
     contributors may be used to endorse or promote products derived
     from this software without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->

<project name="jmx" default="build" basedir=".">

     <import file="../common/shared.xml"/>

    <target name="-pre-init">
        <!-- Set the values for build date and time -->
        <tstamp>
	    <format property="BUILD_DATE"        pattern="yyyy.MM.dd_HH:mm:ss_z" />
	    <format property="BUILD_DATE_SIMPLE" pattern="dd_MMM_yyyy" />
        </tstamp>

        <!-- These properties are set here instead of in the build.properties file, -->
        <!-- because they depend on the values of BUILD_DATE and BUILD_DATE_SIMPLE  -->
        <!-- At this time, ./build.properties has not been loaded yet. -->
        <property name="project.build.name" value="openjdk-bXX"/>
	<property name="project.build.fulltag"
                  value="${ant.project.name}-${project.build.name}-${BUILD_DATE}" />

        <!-- unchecked warnings will be fixed in JMX 2.0 as part of the work
             being done on JSR 255 new features                              -->
        <property name="javac.options"
                  value="-Xlint -Xlint:-deprecation"/>
    </target>


    <target name="-pre-compile" depends="-init">
	<!-- Dir to keep generated stub source -->
        <mkdir dir="${gensrc.dir}" />
    </target>


    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- Call rmic-jmx subtargets -->

    <target name="-rmic-jmx" depends="-init,-rmic-jmx-jrmp,-rmic-jmx-iiop"
	    description="Calls -init,-rmic-jmx-jrmp,-rmic-jmx-iiop"
    />


    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- Generate RMI JRMP stub class files for remote objects -->
    <!-- Generated java files are kept in a separate directory -->

    <target name="-rmic-jmx-jrmp" depends="-init"
            description="Generate RMI JRMP stub class files for remote objects. Keep generated java files in separate dir." >

	<!-- Dir to keep generated stub source -->
        <mkdir dir="${gensrc.dir}" />

        <rmic 	base="${classes.dir}/javax/management"
		sourcebase="${gensrc.dir}"
		includeAntRuntime="no"
		includeJavaRuntime="no"
		stubversion="1.2"
		>
	    <include name="javax/management/remote/rmi/RMIConnectionImpl.class" />
	    <include name="javax/management/remote/rmi/RMIServerImpl.class" />
	</rmic>

    </target>


    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- Generate RMI IIOP stub class files for remote objects -->

    <target name="-rmic-jmx-iiop" depends="-init,-check-jmx-iiop-uptodate" unless="jmx-iiop-uptodate"
            description="Generate RMI IIOP stub class files for remote objects. Do not keep generated java files." >

	<rmic 	base="${classes.dir}"
		includeAntRuntime="no"
		includeJavaRuntime="no"
		stubversion="1.2"
		iiop="yes"
		>
	    <include name="javax/management/remote/rmi/RMIConnectionImpl.class" />
	    <include name="javax/management/remote/rmi/RMIServerImpl.class" />
	</rmic>

    </target>


    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <!-- Check if jmx rmic generated IIOP stub and tie class files are up to date -->

    <target name="-check-jmx-iiop-uptodate" depends="-init">

	<uptodate property="jmx-iiop-uptodate"
		   srcfile="${classes.dir}/javax/management/remote/rmi/RMIConnectionImpl.class"
		targetfile="${classes.dir}/org/omg/stub/javax/management/remote/rmi/_RMIConnectionImpl_Tie.class"
	/>
	<uptodate property="jmx-iiop-uptodate"
		   srcfile="${classes.dir}/javax/management/remote/rmi/RMIServerImpl.class"
		targetfile="${classes.dir}/org/omg/stub/javax/management/remote/rmi/_RMIServerImpl_Tie.class"
	/>

	<echo message="jmx-iiop-uptodate=${jmx-iiop-uptodate}" />

    </target>

    <target name="-post-compile" depends="-init,-rmic-jmx"
            description="Jar JMX class files (including RMI stubs)" >
       <mkdir dir="${dist.dir}/lib"/>
       <jar jarfile="${dist.dir}/lib/${jar.jmx.name}"
	    update="true"
	    index="false"
	    duplicate="fail">
	    <fileset dir="${classes.dir}" excludes="**/*.java"/>
	    <manifest >
		<attribute name="Built-By"                 value="${user.name}" />
		<section name="common">
		    <attribute name="Sealed"                 value="${jar.jmx.sealed}" />
		    <attribute name="Specification-Title"    value="${jar.jmx.spec.title}" />
		    <attribute name="Specification-Version"  value="${jar.jmx.spec.version}" />
		    <attribute name="Specification-Vendor"   value="${jar.jmx.spec.vendor}" />
		    <attribute name="Implementation-Title"   value="${jar.jmx.impl.title}" />
		    <attribute name="Implementation-Version" value="${project.build.fulltag}" />
		    <attribute name="Implementation-Vendor"  value="${jar.jmx.impl.vendor}" />
		</section>
	    </manifest>
       </jar>
    </target>

    <target name="clean" depends="-init,shared.clean">
        <delete file="${dist.dir}/lib/${jar.jmx.name}"/>
    </target>
</project>

Other Java examples (source code examples)

Here is a short list of links related to this Java build.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.