MyFaces Tobago
  1. MyFaces Tobago
  2. TOBAGO-256

the apt plugin fails to execute in embedded environment

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Maven Apt Plugin
    • Labels:
      None
    • Environment:
      maven 2.1-snapshot + mevenide 2.3 + netbeans 5.5

      Description

      the apt plugin seems to fail in embedded environment, like in the netbeans IDE integration.

      when not forked, it cannot find the apt's main class for some reason. This one could be either a problem in the plugin or somewhere in the classloading of maven when embedding (or somewhere else)

      when forked, it fails to execute on windows platform where there is space in the path to jdk. that one seems to be hardly a problem of embedding, but strangely enough it seems to work on command line just fine.

      for details, see http://jira.codehaus.org/browse/MEVENIDE-482

        Activity

        Hide
        Benjamin Bentmann added a comment -

        Users suffering from this issue are advised to migrate their builds to use the apt-maven-plugin:1.0-alpha-3 from the Mojo project which includes a fix for the issue (MOJO-1458).

        Show
        Benjamin Bentmann added a comment - Users suffering from this issue are advised to migrate their builds to use the apt-maven-plugin:1.0-alpha-3 from the Mojo project which includes a fix for the issue (MOJO-1458).
        Hide
        Benjamin Bentmann added a comment -

        From the plugin's source code:

        // we need to have tools.jar in lasspath
        // due to bug in Apt compiler, system classpath must be modified but in future:
        // TODO try separate ClassLoader (see Plexus compiler api)
        if ( !isClasspathModified )
        {
            URL toolsJar = new File( System.getProperty( "java.home" ),
                "../lib/tools.jar" ).toURL();
            Method m = URLClassLoader.class.getDeclaredMethod( "addURL",
                  new Class[] { URL.class } );
            m.setAccessible( true );
            m.invoke( this.getClass().getClassLoader()
                .getSystemClassLoader(), new Object[] { toolsJar } );
            isClasspathModified = true;
        }
        

        hacking the system class loader is a no-no. They should create their own class loader.

        Show
        Benjamin Bentmann added a comment - From the plugin's source code: // we need to have tools.jar in lasspath // due to bug in Apt compiler, system classpath must be modified but in future : // TODO try separate ClassLoader (see Plexus compiler api) if ( !isClasspathModified ) { URL toolsJar = new File( System .getProperty( "java.home" ), "../lib/tools.jar" ).toURL(); Method m = URLClassLoader.class.getDeclaredMethod( "addURL" , new Class [] { URL.class } ); m.setAccessible( true ); m.invoke( this .getClass().getClassLoader() .getSystemClassLoader(), new Object [] { toolsJar } ); isClasspathModified = true ; } hacking the system class loader is a no-no. They should create their own class loader.

          People

          • Assignee:
            Unassigned
            Reporter:
            Milos Kleint
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development