Hi, the feature is apparently not supported for the moment : http://jira.codehaus.org/browse/MPJAVADOC-34 for details
Julien Extranet [EMAIL PROTECTED] - 19/04/2005 16:01 Veuillez r�pondre � [email protected] Pour : users cc : Objet : Re: Javadoc plugin from behind proxy that needs authentication I found how to create the variable on the fly using <j:new/>. I now have this piece of code that downloads the package-list automatically and generates the correct links for when you are stuck behind a firewall that needs authentication. However it does not work! Is the Javadoc plugin responsible on this mailinglist and could he try to help me out? regards, Wim <goal name="maven-javadoc-plugin:report" description="Generate API documentation" prereqs="xdoc:init"> ... some initialization about the year... <j:set var="proxyOnline" value="${maven.javadoc.mode.proxy.online}"/> <ant:echo>proxy mode: ${proxyOnline}</ant:echo> <j:if test="${proxyOnline}"> <!-- Use proxy only mode--> <ant:mkdir dir="${maven.build.dir}/packagelists"/> <util:tokenize var="links" delim="," trim="true">${maven.javadoc.links}</util:tokenize> <j:forEach var="link" items="${links}" indexVar="linkNr"> <ant:echo>Downloading API information from ${link.trim()} ...</ant:echo> <j:set var="remoteFile" value="${link.trim()}package-list"/> <util:file var="localFile" name="${maven.build.dir}/packagelists/${linkNr}/package-list" /> <ant:mkdir dir="${maven.build.dir}/packagelists/${linkNr}"/> <ant:echo>downloading ${remoteFile} to ${localFile}</ant:echo> <j:catch var="ex"> <j:invokeStatic var="dummy" method="getFile" className="org.apache.maven.util.HttpUtils"> <j:arg type="java.lang.String" value="${remoteFile}" /> <j:arg type="java.io.File" value="${localFile}"/> <j:arg type="boolean" value="false"/> <j:arg type="boolean" value="true"/> <j:arg type="java.lang.String" value="${maven.proxy.host}" /> <j:arg type="java.lang.String" value="${maven.proxy.port}" /> <j:arg type="java.lang.String" value="${maven.proxy.username}" /> <j:arg type="java.lang.String" value="${maven.proxy.password}" /> <j:arg type="boolean" value="false"/> </j:invokeStatic> </j:catch> <j:if test="${!empty(ex)}"> <ant:echo>${ex}</ant:echo> </j:if> </j:forEach> <j:set var="maven.javadoc.mode.online" value="false"/> <ant:echo>Creating buffer to generate correct offlineLinks</ant:echo> <j:new var="linksBuffer" className="java.lang.StringBuffer"/> <j:forEach var="link" items="${links}" indexVar="linkNr"> <ant:echo>Appending '${link}#${maven.build.dir}/packaglists/${linkNr}/package-list' to buffer </ant:echo> <j:invoke method="append" on="${linksBuffer}"> <j:arg type="java.lang.String" value="${link}#${maven.build.dir}/packaglists/${linkNr},"/> </j:invoke> </j:forEach> <j:set var="maven.javadoc.offlineLinks" value="${linksBuffer.toString()}"/> <ant:echo>${maven.javadoc.offlineLinks}</ant:echo> </j:if> <!-- calculate online/offline mode --> ... rest of the goal... </goal> On 4/19/05, Wim Deblauwe <[EMAIL PROTECTED]> wrote: > Hi, > > we have a http proxy at work that needs authentication. If I want to > have links in my Javadocs to other libraries I use, I can't use the > normal mechanism > (http://maven.apache.org/reference/plugins/javadoc/faq.html#firewall). > > However, plugin:download manages to get through the firewall, so the > javadoc should be able to do it also. I changed the goal > "maven-javadoc-plugin:report" in the javadoc plugin like this: > > <j:set var="proxyOnline" value="${maven.javadoc.mode.proxy.online}"/> > <ant:echo>proxy mode: ${proxyOnline}</ant:echo> > <j:choose> > <j:when test="${proxyOnline}"> > <!-- Use proxy only mode--> > <ant:mkdir dir="${maven.build.dir}/packagelists"/> > <util:tokenize var="links" delim="," > trim="true">${maven.javadoc.links}</util:tokenize> > <j:forEach var="link" items="${links}" indexVar="linkNr"> > <ant:echo>Downloading API information from ${link.trim()} ...</ant:echo> > <j:set var="remoteFile" value="${link.trim()}package-list"/> > <util:file var="localFile" > name="${maven.build.dir}/packagelists/${linkNr}-package-list" /> > <ant:echo>downloading ${remoteFile} to ${localFile}</ant:echo> > <j:catch var="ex"> > <j:invokeStatic var="dummy" method="getFile" > className="org.apache.maven.util.HttpUtils"> > <j:arg type="java.lang.String" value="${remoteFile}" /> > <j:arg type="java.io.File" value="${localFile}"/> > <j:arg type="boolean" value="false"/> > <j:arg type="boolean" value="true"/> > <j:arg type="java.lang.String" value="${maven.proxy.host}" /> > <j:arg type="java.lang.String" value="${maven.proxy.port}" /> > <j:arg type="java.lang.String" value="${maven.proxy.username}" /> > <j:arg type="java.lang.String" value="${maven.proxy.password}" /> > <j:arg type="boolean" value="false"/> > </j:invokeStatic> > </j:catch> > <ant:echo>${ex}</ant:echo> > <ant:echo>${ex.printStacktrace()}</ant:echo> > </j:forEach> > </j:when> > <j:otherwise> > > <!-- calculate online/offline mode --> > <j:set var="online" value="${maven.javadoc.mode.online}"/> > <j:if test="${empty(online)}"> > <j:set var="online" value="${maven.mode.online}"/> > </j:if> > > <j:choose> > <j:when test="${online}"> > <util:tokenize var="links" delim="," > trim="true">${maven.javadoc.links}</util:tokenize> > <j:forEach var="link" items="${links}"> > <ant:echo>Linking with API information from ${link.trim()} ...</ant:echo> > </j:forEach> > </j:when> > <j:otherwise> > <util:tokenize var="links" delim="," > trim="true">${maven.javadoc.offlineLinks}</util:tokenize> > <j:forEach var="link" items="${links}"> > <ant:echo>Linking offline API information from ${link.trim()} > ...</ant:echo> > </j:forEach> > </j:otherwise> > </j:choose> > > </j:otherwise> > </j:choose> > > Basically, it uses the HttpUtils class to download the package-list's > into a directory 'package-lists'. To make a difference, I prepended > the files with a number. > > Suppose I have this: > maven.javadoc.links=http://java.sun.com/j2se/1.5.0 /docs/api/,http://jakarta.apache.org/commons/lang/api/ > > I can now generate the offline links > (http://maven.apache.org/reference/plugins/javadoc/faq.html#offlineLinks ): > > maven.javadoc.offlineLinks=http://java.sun.com/j2se/1.5.0 /docs/api/#${path.to.downloaded.packagelists}/1-package-list,http://jakarta.apache.org/commons/lang/api/#${path.to.downloaded.packagelists}/2-package-list > > then I only need to set the mode to offline, and I should get nice > links in my javadocs. > > How can I create that "maven.javadoc.offlineLinks" variabel on the fly? > > regards, > > Wim > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. --------------------------------------------- Ce message et toutes les pieces jointes (ci-apres le "message") sont etablis a l'intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le detruire et d'en avertir immediatement l'expediteur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L'internet ne permettant pas d'assurer l'integrite de ce message, BNP PARIBAS (et ses filiales) decline(nt) toute responsabilite au titre de ce message, dans l'hypothese ou il aurait ete modifie. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
