maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Crater (JIRA)" <j...@codehaus.org>
Subject [jira] Updated: (MECLIPSE-518) NPE when generating WTP configuration files - sometimes - very strange
Date Tue, 29 Dec 2009 14:46:55 GMT

     [ http://jira.codehaus.org/browse/MECLIPSE-518?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jon Crater updated MECLIPSE-518:
--------------------------------

    Attachment: MECLIPSE-518.diff

It appears this is a bug in the logic used to reach the top of the reactor.  If the top of
the reactor is a file system root directory (i.e., no parent directory above the reactor root),
then modulesTop.getParentFile() returns null.  The patched code (diff attached here) assumes
that when null is reached that modulesTop is the root of the reactor.

{code:title=IdeDependency.java (broken)|borderStyle=solid}
// old method
public boolean isSystemScopedOutsideProject( MavenProject project )
    {
        File modulesTop = project.getBasedir();
        while ( new File( modulesTop.getParentFile(), "pom.xml" ).exists() )
        {
            modulesTop = modulesTop.getParentFile();
        }
        return isSystemScoped() && !getFile().getAbsolutePath().startsWith( modulesTop.getAbsolutePath()
);
    }
{code}

{code:title=IdeDependency.java (fixed)|borderStyle=solid}
// patched method
public boolean isSystemScopedOutsideProject( MavenProject project )
    {
        File modulesTop = project.getBasedir();
        while ( new File( modulesTop.getParentFile(), "pom.xml" ).exists() )
        {
        	if(modulesTop.getParentFile() != null) 
        	{
        		modulesTop = modulesTop.getParentFile();
        	}
        	else 
        	{
        		break;
        	}
        }
        return isSystemScoped() && !getFile().getAbsolutePath().startsWith( modulesTop.getAbsolutePath()
);
    }
{code} 

> NPE when generating WTP configuration files - sometimes - very strange
> ----------------------------------------------------------------------
>
>                 Key: MECLIPSE-518
>                 URL: http://jira.codehaus.org/browse/MECLIPSE-518
>             Project: Maven 2.x Eclipse Plugin
>          Issue Type: Bug
>          Components: WTP support
>    Affects Versions: 2.5.1
>         Environment: Windows XP, java 1.6, mvn 2.0.9
>            Reporter: Martin Monsorno
>         Attachments: MECLIPSE-518.diff
>
>
> When running {{mvn eclipse:eclipse -Dwtpversion=2.0}} on my project, I get a NullPointerException,
but only in some directories! E.g. when the project sources lie in d:\epa-trunk, I get the
following output:
> {quote}
> D:\epa-trunk\web>mvn eclipse:eclipse -Dwtpversion=2.0
> [INFO] Scanning for projects...
> [INFO] Searching repository for plugin with prefix: 'eclipse'.
> [INFO] ------------------------------------------------------------------------
> [INFO] Building epa-web
> [INFO]    task-segment: [eclipse:eclipse]
> [INFO] ------------------------------------------------------------------------
> [INFO] Preparing eclipse:eclipse
> [INFO] [enforcer:enforce {execution: default}]
> [INFO] [eclipse:eclipse]
> [INFO] Adding support for WTP version 2.0.
> [INFO] Using as WTP server : null
> [INFO] Adding default classpath contaigner: org.eclipse.jdt.launching.JRE_CONTAINER
> [INFO] Using source status cache: D:\epa-trunk\web\target\mvn-eclipse-cache.properties
> [INFO] ------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO] ------------------------------------------------------------------------
> [INFO] null
> [INFO] ------------------------------------------------------------------------
> [INFO] Trace
> java.lang.NullPointerException
>         at org.apache.maven.plugin.ide.IdeDependency.isSystemScopedOutsideProject(IdeDependency.java:519)
>         at org.apache.maven.plugin.eclipse.writers.wtp.AbstractWtpResourceWriter.writeWarOrEarResources(AbstractWtpResourceWriter.java:280)
>         at org.apache.maven.plugin.eclipse.writers.wtp.EclipseWtpComponentWriter.writeModuleTypeComponent(EclipseWtpComponentWriter.java:188)
>         at org.apache.maven.plugin.eclipse.writers.wtp.EclipseWtpComponentWriter.write(EclipseWtpComponentWriter.java:105)
>         at org.apache.maven.plugin.eclipse.EclipsePlugin.writeConfiguration(EclipsePlugin.java:945)
>         at org.apache.maven.plugin.ide.AbstractIdeSupportMojo.execute(AbstractIdeSupportMojo.java:494)
>         at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
>         at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>         at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 4 seconds
> [INFO] Finished at: Mon Dec 29 15:00:14 CET 2008
> [INFO] Final Memory: 19M/35M
> [INFO] ------------------------------------------------------------------------
> {quote}
> When moving the sources to d:\tmp, the build completes successfully:
> {quote}
> D:\epa-trunk\web>cd ..\..
> D:\>move epa-trunk tmp
> D:\>cd tmp\epa-trunk\web
> D:\tmp\epa-trunk\web>mvn eclipse:eclipse -Dwtpversion=2.0
> [INFO] Scanning for projects...
> [INFO] Searching repository for plugin with prefix: 'eclipse'.
> [INFO] ------------------------------------------------------------------------
> [INFO] Building epa-web
> [INFO]    task-segment: [eclipse:eclipse]
> [INFO] ------------------------------------------------------------------------
> [INFO] Preparing eclipse:eclipse
> [INFO] [enforcer:enforce {execution: default}]
> [INFO] [eclipse:eclipse]
> [INFO] Adding support for WTP version 2.0.
> [INFO] Using as WTP server : null
> [INFO] Adding default classpath contaigner: org.eclipse.jdt.launching.JRE_CONTAINER
> [INFO] Using source status cache: D:\tmp\epa-trunk\web\target\mvn-eclipse-cache.properties
> [INFO] File D:\tmp\epa-trunk\web\.project already exists.
>        Additional settings will be preserved, run mvn eclipse:clean if you want old settings
to be removed.
> [INFO] Wrote Eclipse project for "epa-web" to D:\tmp\epa-trunk\web.
> [INFO]
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 4 seconds
> [INFO] Finished at: Mon Dec 29 15:01:52 CET 2008
> [INFO] Final Memory: 19M/35M
> [INFO] ------------------------------------------------------------------------
> {quote}
> Remarks: 
> - web is the web module of my multi-module-project in epa-trunk
> - It's the same for wtpversion=1.5.

-- 
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
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message