The following comment has been added to this issue:

     Author: Anthony FIRKA
    Created: Wed, 31 Mar 2004 10:51 AM
       Body:
Hi!  With maven-1.0-rc1, I used to import a globally shared jelly script from my 
subprojects maven.xml file, using something like that:

<project xmlns:j="jelly:core">
    <j:include file="${myGlobalVariable}/mySubDirectory/mySharedScript.jelly" />
</project>

Now and since the 1.0-rc2, I use <j:import/> instead of <j:include/> tag but, as you 
explained, expressions are not parsed here. Gasp'. So, I've modified the 
maven-1.0-rc3-SNAPSHOT PluginScriptParser class and it fixes my problem, allowing me 
to use a global variable.


I've added one static member:

--><------------------------------
/** Maven Expression Factory. */
private static MavenExpressionFactory mavenExpressionFactory = new 
MavenExpressionFactory();
--><------------------------------


and inside the startElement(String, String, String, Attributes) method, I've replaced 
the three following comment lines:

--><------------------------------
// We -could- evaluate this as an expression, but the only thing set at this point is 
${basedir}
// and some expressions will spit out exceptions (eg ${context.getVariable('blah')})
// TODO: maybe sub in basedir, plugin.resources and plugin.dir?
--><------------------------------


by:

--><------------------------------
// Quick fix for evaluating simple expressions such as
// <j:import file="${myGlobalVariable}/mySubDir/myScript.jelly"/>
//
// It will crash if you use some more complex objects in
// your expression.
try
{
    MavenJellyContext context = jellyScriptHousing.getProject().getContext();

    if ( context != null )
    {
        log.debug( rawName + " try to evalutate uri attribute as an expression." );
        Expression expr = JellyUtils.decomposeExpression( importUri, 
mavenExpressionFactory, context );

        importUri = expr.evaluateAsString( context );
    }
}
catch ( Exception e )
{
    log.error( rawName + " can't evaluate uri attribute, bypassing." );
}
--><------------------------------


I hope this may help, even if it doesn't support all cases.
Bye bye, Thonio --
---------------------------------------------------------------------
View this comment:
  
http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-1161&page=comments#action_18033

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-1161

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MAVEN-1161
    Summary: goal mapper does not follow j:import tags
       Type: Bug

     Status: Closed
   Priority: Minor
 Resolution: FIXED

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: maven
 Components: 
             jelly/ant integration
             plugin manager
   Fix Fors:
             1.0-rc3
   Versions:
             1.0-rc2

   Assignee: Brett Porter
   Reporter: dion gillard

    Created: Wed, 11 Feb 2004 11:54 PM
    Updated: Wed, 31 Mar 2004 10:51 AM

Description:
RC2 displays an error message for tag libraries that are imported and declared in 
maven.xml.

RC1 does not.

See zip file attachment for sample to reproduce the bug.

Here is the output from running the sample with RC2 and then RC1.

C:\Temp\mavenBug>maven showBug
 __  __
|  \/  |__ _Apache__ ___
| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
|_|  |_\__,_|\_/\___|_||_|  v. 1.0-rc2-SNAPSHOT

Tag library requested that is not present: 'bug' in plugin: 'maven:maven'
showBug:
    [echo] Hello World
BUILD SUCCESSFUL
Total time: 7 seconds
Finished at: Thu Feb 12 15:45:47 EST 2004


C:\Temp\mavenBug>mavenrc1 showBug
 __  __
|  \/  |__ _Apache__ ___
| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
|_|  |_\__,_|\_/\___|_||_|  v. 1.0-rc1-SNAPSHOT

showBug:
    [echo] Hello World
BUILD SUCCESSFUL
Total time: 18 seconds
Finished at: Thu Feb 12 15:46:17 EST 2004



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to