You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dominique Devienne <DD...@lgc.com> on 2002/11/26 17:52:24 UTC
RE: Accessing manifest information from within an ant build
I think this should answer your question ;-) --DD
PS: My longest and most complex JavaScript ever ;-)
P:\org_apache\antx>%ANT_HOME%\bin\ant -f jar-version-script.xml
Buildfile: jar-version-script.xml
test:
[script] C:\pro\jdk1.4\jre\lib\charsets.jar <not-found>
[script] C:\pro\jdk1.4\jre\lib\jaws.jar <not-found>
[script] C:\pro\jdk1.4\jre\lib\jce.jar <not-found>
[script] C:\pro\jdk1.4\jre\lib\jsse.jar 1.4
[script] C:\pro\jdk1.4\jre\lib\rt.jar 1.4.0
[script] C:\pro\jdk1.4\jre\lib\sunrsasign.jar <not-found>
BUILD SUCCESSFUL
Total time: 1 second
P:\org_apache\antx>type jar-version-script.xml
<?xml version="1.0"?>
<!-- ANT build file to test a specific feature or bug of ANT.
Dominique Devienne <dd...@lgc.com> November 2002
-->
<project name="jar-version" default="test">
<target name="test">
<fileset id="jars" dir="${java.home}/lib" includes="*.jar" />
<!-- Iterate over the fileset, printing the filenames.
Then attempt to open each file as a JAR, and read its manifest
to extract the specification version, if any. -->
<script language="javascript"><![CDATA[
prj = self.getProject();
jars = prj.getReference("jars");
dir = new java.io.File(jars.getDir(prj));
filenames = jars.getDirectoryScanner(prj).getIncludedFiles();
for (var i = 0; i < filenames.length; ++i) {
file = new java.io.File(dir, filenames[i]);
jar = new java.util.jar.JarFile(file);
name = java.util.jar.Attributes.Name.IMPLEMENTATION_VERSION;
version = jar.getManifest().getMainAttributes().getValue(name);
version = (version == null)? "<not-found>": version;
java.lang.System.out.println(file + " " + version);
}
]]></script>
</target>
</project>
P:\org_apache\antx>
-----Original Message-----
From: Frank Carver [mailto:frank@efsol.com]
Sent: Saturday, November 23, 2002 2:47 AM
To: Ant Users List
Subject: RE: Accessing manifest information from within an ant build
Dominique Devienne <DD...@lgc.com> said:
> I don't think so. Not directly. I'd define a fileset of your JARs, and
write
> a small JavaScript to look over it, and use JDK's
>
> import java.util.jar.*;
> new JarFile(filename).getManifest().getMainAttributes().getValue(
> Attributes.Name.IMPLEMENTATATION_VERSION);
>
> Almost a one liner ;-) --DD
That looks neat. Can you expand a little on the "look over it" part. I
don't
know to get the filenames out of a fileset like that, and a variation on
this
approach would be a great solution for a couple other problems which have
popped
up on this list over the last few weeks.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
help regarding websphere with ant????????
Posted by manish kumar <ma...@yahoo.com>.
> hi everyone
> i want to know something abt using ant with
> websphere?
> Cold someone give me an example or snapshot of
> build.xml file which could be used in websphere??
>
> i just wanna know how to deploy the application in
> websphere using ant??
> what is the ant task to call to deploy and to create
> the stubs and skeletons for websphere???
> i dont want to use the AAT or admin tool for
> websphere.
>
> thanx in advance
>
> --- Dominique Devienne <DD...@lgc.com> wrote:
> > I think this should answer your question ;-) --DD
> >
> > PS: My longest and most complex JavaScript ever
> ;-)
> >
> > P:\org_apache\antx>%ANT_HOME%\bin\ant -f
> > jar-version-script.xml
> > Buildfile: jar-version-script.xml
> >
> > test:
> > [script] C:\pro\jdk1.4\jre\lib\charsets.jar
> > <not-found>
> > [script] C:\pro\jdk1.4\jre\lib\jaws.jar
> > <not-found>
> > [script] C:\pro\jdk1.4\jre\lib\jce.jar
> > <not-found>
> > [script] C:\pro\jdk1.4\jre\lib\jsse.jar 1.4
> > [script] C:\pro\jdk1.4\jre\lib\rt.jar 1.4.0
> > [script] C:\pro\jdk1.4\jre\lib\sunrsasign.jar
> > <not-found>
> >
> > BUILD SUCCESSFUL
> > Total time: 1 second
> > P:\org_apache\antx>type jar-version-script.xml
> > <?xml version="1.0"?>
> >
> > <!-- ANT build file to test a specific feature or
> > bug of ANT.
> > Dominique Devienne <dd...@lgc.com>
> > November 2002
> > -->
> > <project name="jar-version" default="test">
> >
> > <target name="test">
> > <fileset id="jars" dir="${java.home}/lib"
> > includes="*.jar" />
> >
> > <!-- Iterate over the fileset, printing the
> > filenames.
> > Then attempt to open each file as a JAR,
> > and read its manifest
> > to extract the specification version, if
> > any. -->
> > <script language="javascript"><![CDATA[
> > prj = self.getProject();
> > jars = prj.getReference("jars");
> > dir = new java.io.File(jars.getDir(prj));
> > filenames =
> > jars.getDirectoryScanner(prj).getIncludedFiles();
> > for (var i = 0; i < filenames.length; ++i) {
> > file = new java.io.File(dir,
> filenames[i]);
> > jar = new java.util.jar.JarFile(file);
> > name =
> >
>
java.util.jar.Attributes.Name.IMPLEMENTATION_VERSION;
> > version =
> >
>
jar.getManifest().getMainAttributes().getValue(name);
> > version = (version == null)?
> "<not-found>":
> > version;
> > java.lang.System.out.println(file + " " +
> > version);
> > }
> > ]]></script>
> > </target>
> >
> > </project>
> >
> > P:\org_apache\antx>
> >
> > -----Original Message-----
> > From: Frank Carver [mailto:frank@efsol.com]
> > Sent: Saturday, November 23, 2002 2:47 AM
> > To: Ant Users List
> > Subject: RE: Accessing manifest information from
> > within an ant build
> >
> >
> > Dominique Devienne <DD...@lgc.com> said:
> >
> > > I don't think so. Not directly. I'd define a
> > fileset of your JARs, and
> > write
> > > a small JavaScript to look over it, and use
> JDK's
> > >
> > > import java.util.jar.*;
> > > new
> >
>
JarFile(filename).getManifest().getMainAttributes().getValue(
> > > Attributes.Name.IMPLEMENTATATION_VERSION);
> > >
> > > Almost a one liner ;-) --DD
> >
> > That looks neat. Can you expand a little on the
> > "look over it" part. I
> > don't
> > know to get the filenames out of a fileset like
> > that, and a variation on
> > this
> > approach would be a great solution for a couple
> > other problems which have
> > popped
> > up on this list over the last few weeks.
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Accessing manifest information from within an ant build
Posted by manish kumar <ma...@yahoo.com>.
hi everyone
i want to know something abt using ant with websphere?
Cold someone give me an example or snapshot of
build.xml file which could be used in websphere??
i just wanna know how to deploy the application in
websphere using ant??
what is the ant task to call to deploy and to create
the stubs and skeletons for websphere???
i dont want to use the AAT or admin tool for
websphere.
thanx in advance
--- Dominique Devienne <DD...@lgc.com> wrote:
> I think this should answer your question ;-) --DD
>
> PS: My longest and most complex JavaScript ever ;-)
>
> P:\org_apache\antx>%ANT_HOME%\bin\ant -f
> jar-version-script.xml
> Buildfile: jar-version-script.xml
>
> test:
> [script] C:\pro\jdk1.4\jre\lib\charsets.jar
> <not-found>
> [script] C:\pro\jdk1.4\jre\lib\jaws.jar
> <not-found>
> [script] C:\pro\jdk1.4\jre\lib\jce.jar
> <not-found>
> [script] C:\pro\jdk1.4\jre\lib\jsse.jar 1.4
> [script] C:\pro\jdk1.4\jre\lib\rt.jar 1.4.0
> [script] C:\pro\jdk1.4\jre\lib\sunrsasign.jar
> <not-found>
>
> BUILD SUCCESSFUL
> Total time: 1 second
> P:\org_apache\antx>type jar-version-script.xml
> <?xml version="1.0"?>
>
> <!-- ANT build file to test a specific feature or
> bug of ANT.
> Dominique Devienne <dd...@lgc.com>
> November 2002
> -->
> <project name="jar-version" default="test">
>
> <target name="test">
> <fileset id="jars" dir="${java.home}/lib"
> includes="*.jar" />
>
> <!-- Iterate over the fileset, printing the
> filenames.
> Then attempt to open each file as a JAR,
> and read its manifest
> to extract the specification version, if
> any. -->
> <script language="javascript"><![CDATA[
> prj = self.getProject();
> jars = prj.getReference("jars");
> dir = new java.io.File(jars.getDir(prj));
> filenames =
> jars.getDirectoryScanner(prj).getIncludedFiles();
> for (var i = 0; i < filenames.length; ++i) {
> file = new java.io.File(dir, filenames[i]);
> jar = new java.util.jar.JarFile(file);
> name =
>
java.util.jar.Attributes.Name.IMPLEMENTATION_VERSION;
> version =
>
jar.getManifest().getMainAttributes().getValue(name);
> version = (version == null)? "<not-found>":
> version;
> java.lang.System.out.println(file + " " +
> version);
> }
> ]]></script>
> </target>
>
> </project>
>
> P:\org_apache\antx>
>
> -----Original Message-----
> From: Frank Carver [mailto:frank@efsol.com]
> Sent: Saturday, November 23, 2002 2:47 AM
> To: Ant Users List
> Subject: RE: Accessing manifest information from
> within an ant build
>
>
> Dominique Devienne <DD...@lgc.com> said:
>
> > I don't think so. Not directly. I'd define a
> fileset of your JARs, and
> write
> > a small JavaScript to look over it, and use JDK's
> >
> > import java.util.jar.*;
> > new
>
JarFile(filename).getManifest().getMainAttributes().getValue(
> > Attributes.Name.IMPLEMENTATATION_VERSION);
> >
> > Almost a one liner ;-) --DD
>
> That looks neat. Can you expand a little on the
> "look over it" part. I
> don't
> know to get the filenames out of a fileset like
> that, and a variation on
> this
> approach would be a great solution for a couple
> other problems which have
> popped
> up on this list over the last few weeks.
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>