Well, after some coding, the first seedling of CJAN is in place. The
checked in ant optional task basically works like this:
<target ....>
<cjan
localRepository="${cjan.repository.local}"
remoteRepository="${cjan.repository.remote}">
<get jar="xerces-1.3.1.jar" property="xerces.jar"/>
<get jar="xalan-2.0.1.jar" property="xalan.jar"/>
</cjan>
<echo message="xerces.jar is ${xerces.jar}"/>
<echo message="xalan.jar is ${xalan.jar}"/>
</target>
The output looks something like:
test-cjan:
[echo] Testing cjan...
[cjan] Checking for local file: /opt/cjan/xerces-1.3.1.jar
[cjan] File: /opt/cjan/xerces-1.3.1.jar already exists. No need
to download.
[cjan] Setting property xerces.jar to /opt/cjan/xerces-1.3.1.jar
[cjan] Checking for local file: /opt/cjan/xalan-2.0.1.jar
[cjan] Attempting to download file:/opt/cjanremote/xalan-2.0.1.jar
to local repository.
[cjan] Setting property xalan.jar to /opt/cjan/xalan-2.0.1.jar
[echo] property 'xerces.jar' is /opt/cjan/xerces-1.3.1.jar
[echo] property 'xalan.jar' is /opt/cjan/xalan-2.0.1.jar
Basically, the localRepository defaults to the property listed above and
is an absolutePath to where the remote jars are copied/checked for.
The remoteRepository defaults to the property listed above if not given,
so it is possible to have just a <cjan> task, and the repositories will
still be found. They are just there to be overridden. The remote
repository is in the format of a URL (i.e. http://www.foo.org/cjan). I
am currently using file:///opt/cjanremote.
the <get> first sees if the filename in the jar attribute exists in the
local repository. If so, then it does not retreive. If the file does
not exist, the URL is opened and written to the local repository. The
property specified in the property attribute is then checked. If it is
null, then it is set to the specified local filename.
That's it for now. This is a decent start.
Now where do we want to go?
Is the ant task the way to go?
I see it still as an ant task, with an xml-based repository of project
metadata somewhere, such as http://jakarta.apache.org/cjan/repository,
downloading an XML file corresponding to the project (ie xerces.xml),
which then tells cjan about all the different released versions, and
where to download them. Something like this:
<?xml version="1.0" encoding="utf-8"?>
<project name="xml-xerces">
<component name="xerces">
<revision version="1.2">
<test class="org.apache.xerces.xml.foo"/>
<jar url="http://xml.apache.org/bin/xml-xerces/xerces-1.2.jar"/>
</revision>
<revision version="1.3.1">
<test class="org.apache.xerces.xml.foo31"/>
<jar url="http://xml.apache.org/bin/xml-xerces/xerces-1.3.1.jar"/>
</revision>
</component>
</project>
Thoughts?
Scott Sanders