| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Commons Attributes example source code file (compiler.xml)

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

Java - Commons Attributes tags/keywords

attribute, attribute, cdata, compiler, compiler, do, java, java, license, license, no, see, the, you

The Commons Attributes compiler.xml source code

<?xml version="1.0"?>
= Copyright 2003-2004 The Apache Software Foundation
= Licensed under the Apache License, Version 2.0 (the "License");
= you may not use this file except in compliance with the License.
= You may obtain a copy of the License at
= Unless required by applicable law or agreed to in writing, software
= distributed under the License is distributed on an "AS IS" BASIS,
= See the License for the specific language governing permissions and
= limitations under the License.
        <author email="">Jakarta Commons Development Team
        <title>Reference - Compiling
        <section name="The AttributeCompiler Ant Task">
            <p>This is the process your source files have to go through:

<source>|Generated Java Files| +------------+ +--------------------+ | | | | | +-------------+ | +-------------->|Java Compiler|<------------------+ +-------------+ | v +-----------------+ |Java .class files| +-----------------+]]></source> <p> This section will focus on the "Attribute Compiler" step. As is implied by the diagram, the Attribute Compiler compiles Java source files into other Java source files. </p> <p> This is how the compiler is used: </p> <source> <attribute-compiler destdir="temp/" attributepackages="my.attributes;my.otherattributes"> <fileset dir="src/" includes="*.java"/> </attribute-compiler>]]> <table> <tr> <th> Parameter </th> <th> Required </th> <th> Description </th> </tr> <tr> <td> destdir </td> <td> Yes </td> <td> Destination directory for generated source files </td> </tr> <tr> <td> attributepackages </td> <td> No </td> <td> A semi-colon separated list of package names. Attributes in these packages can be used without specifying their fully-qualified names, even if they are not in the same package as the class they are being attached to, and even if they are not imported. (The compiler generates import statements in the generated source files.) </td> </tr> </table> <p> After the attribute compiler has generated the new source files, you should feed them <b>and your own source files to the Java compiler. </p> </section> <section name="Do I Have to Use the Attribute Compiler?"> <p> No, you don't. You can add attributes to a class by programmatically creating an attribute repository in the class's static initializer. See the Javadoc for <a href="api/org/apache/commons/attributes/RuntimeAttributeRepository.html">RuntimeAttributeRepository for an example. <i>It's not pretty, but it works. </p> </section> <section name="How Do I Use It With Maven?"> <p> If you use Maven you can just install the Commons-Attributes plugin and add the following lines to your </p> <source> <p> Attribute compilation will happen automatically. </p> </section> </body> </document>

Other Commons Attributes examples (source code examples)

Here is a short list of links related to this Commons Attributes compiler.xml source code file:

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

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
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.