JAR(1M)MAKE ASSERTION OPERATORS AND RULESJAR(1M)


NAME

:JAR: - java jar file assertion operator

SYNOPSIS

[ name ] [ version ] :JAR: [ options ] [ default-pattern ] [ manifest.mf ] [ directory/file-pattern ] [ directory ] [ relative-path-name(.jar|.java) ] [ { manifest } ]

DESCRIPTION

The :JAR: assertion operator maintains a jar(1) file by compiling prerequisite .java files into .class files and adding them to the jar file. The preferred usage is to specify the jar manifest file as the action of the :JAR: assertion. For example:

      :JAR: foo.1
         Name:                    foo
         Main-Class:              com.nilco.tools.foo.main
         Specification-Title:     foo command
         Specification-Version:   1.2.3
         Specification-Vendor:    Nilco Inc

specifies foo.jar (from the Name: manifest entry) built from all .java files in all subdirectories of ., and a wrapper script that executes the jar file by calling the entry point com.nilco.tools.foo.main (from the Main-Class: manifest entry.) Alternatively the manifest can be specified as a .mf prerequisite file. Specific .java file and/or directory prerequisites limit the jar classes to those specific files and directory hierarchies. directory/file-pattern prerequisites add files in directory matching file-pattern. directory prerequisites add files in directory matching default-pattern and JARMATCH (WARMATCH if --war is specified or EARMATCH if --ear is specified.) More than one default-pattern may be specified. Perequisites matching default-pattern and JARMATCH (WARMATCH or EARMATCH) are added to the jar. A + prerequisite causes subsequent prerequsites to be added to the jar regardless of any matching expressions. A subsequent + prerequisite retruns to the normal JARMATCH or WARMATCH matching. Multiple + pairs may appear. The optional LHS name and version targets override the Name: and Specification-Version: manifest entries.

:JAR: implicitly asserts :JAVA:, activating all java rule and variable definitions. See JAVA(1M) for details. The nmake install action installs the target jar file in the directory $(JAVADIR); the jar wrapper script, if any, is installed in $(BINDIR).

Temporary files with base name the same as the target jar file base name may be generated and retained in the current directory. These may be overwritten on each nmake execution and will be deleted by the clobber common action.

The options are:

--classes=directory

Sets local compiled .class file directory to directory. Local .class files will be in directory but jar member names will not be prefixed by directory. The default is $(WARCLASSES) if --war is set and $(JARCLASSES) otherwise.
--code

Include .java source code in the jar. The :JAVA: --code option can change the default; if the default is --code then --nocode overrides the default for the current jar.
--prefix=directory

Sets local compiled .class file directory to directory. Local .class files will be in directory and jar member names will be prefixed by directory.
--version=version

Sets the VERSION variable to version and the jar filename to base$(JAVA.VERSION.SEPARATOR)$(VERSION).suffix.
--versioned

If VERSION is set then the jar filename is set to base$(JAVA.VERSION.SEPARATOR)$(VERSION).suffix.
--war

Enables .war-specific defaults: $(JAVA.SUFFIX.WAR) jar suffix, $(WARCLASSES) local class root directory, and $(WARMATCH) .war member file match pattern.

VARIABLES AND ATOMS

JAR
The name of the jar(1) command.
JARCLASSES

The local directory root path for .class files compiled from .java files.
JARFLAGS

The default jar(1) options.
JARINDEXFLAGS

The jar(1) options to update the meta index. This index is updated each time the target jar file is modified. If JARINDEXFLAGS is empty then no index is generated.
JARJAVAFLAGS

Runtime java(1) options added to the target jar file. These are typically of the form -J-java-option.
JARMATCH

An extended ksh(1) file match pattern for non-class files added to the jar.
WARCLASSES

The local directory root path for .class files compiled from .java files when --war is specified.
WARMATCH

An extended ksh(1) file match pattern for non-class files added to the war when --war is specified.

SEE ALSO

JAVA(1M), WAR(1M), jar(1), jmake(1), nmake(1)

IMPLEMENTATION

JAR.mk (AT&T Research) 2011-07-25


July 28, 2011