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.