brett 2004/03/22 18:56:59 Modified: src/java/org/apache/maven/plugin Tag: MAVEN-1_0-BRANCH PluginScriptParser.java Log: PR: MAVEN-1161 follow j:import tags Revision Changes Path No revision No revision 1.1.4.6 +36 -2 maven/src/java/org/apache/maven/plugin/PluginScriptParser.java Index: PluginScriptParser.java =================================================================== RCS file: /home/cvs/maven/src/java/org/apache/maven/plugin/PluginScriptParser.java,v retrieving revision 1.1.4.5 retrieving revision 1.1.4.6 diff -u -r1.1.4.5 -r1.1.4.6 --- PluginScriptParser.java 1 Mar 2004 22:36:38 -0000 1.1.4.5 +++ PluginScriptParser.java 23 Mar 2004 02:56:59 -0000 1.1.4.6 @@ -21,16 +21,20 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.xml.sax.Attributes; +import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; +import java.io.FileInputStream; +import java.io.IOException; import java.util.HashSet; import java.util.Set; +import javax.xml.parsers.ParserConfigurationException; + /** * Class to parse plugin XML scripts to find goals and tag libraries. - * @todo this is only being used for caching - instead load the plugin entirely, then cache the actual goals and hooks [RC2] - * @todo [RC2] not currently used - needs to be merged back in with GoalToJelyScriptHousingMapper parser + * * @author Brett Porter <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> */ final class PluginScriptParser extends DefaultHandler @@ -47,6 +51,9 @@ /** Storage of defined dynamic tag libraries. */ private final Set dynaTagLibDecls = new HashSet(); + /** The bound URI for jelly's core tag library. */ + private String jellyCoreUri = null; + /** * Constructor. */ @@ -72,6 +79,10 @@ */ public void startPrefixMapping( String prefix, String uri ) { + if ( uri.equals( "jelly:core" ) ) + { + jellyCoreUri = uri; + } if ( !prefix.equals( "" ) && !uri.startsWith( "jelly:" ) && !uri.startsWith( "dummy" ) && !uri.equals( "" ) ) { dynaTagLibDecls.add( uri ); @@ -89,6 +100,29 @@ */ public void startElement( String uri, String localName, String rawName, Attributes attributes ) { + if ( uri.equals( jellyCoreUri ) ) + { + if ( localName.equals( "import" ) ) + { + String scriptUri = attributes.getValue( "uri" ); + try + { + jellyScriptHousing.parse( handler, new FileInputStream( scriptUri ) ); + } + catch ( SAXException e ) + { + log.warn( "Unable to parse URI '" + scriptUri + "' due to exception, skipping", e ); + } + catch ( ParserConfigurationException e ) + { + log.warn( "Unable to parse URI '" + scriptUri + "' due to exception, skipping", e ); + } + catch ( IOException e ) + { + log.warn( "Unable to read URI '" + scriptUri + "' due to exception, skipping", e ); + } + } + } // TODO: only honour for maven.xml if ( rawName.equals( "project" ) ) {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]