buildConfig.setClasspath( cp );
List elements = new ArrayList( cp.size() ); for ( Iterator i = cp.iterator(); i.hasNext(); ) { elements.add( ( (File) i.next() ).getAbsolutePath() ); }  buildConfig.setClasspath( elements );
    public List compile( CompilerConfiguration config ) throws Exception    {        List messages = new ArrayList();        AjBuildConfig buildConfig = new AjBuildConfig();        buildConfig.setIncrementalMode( false );        String[] files = getSourceFiles( config );        if ( files != null )        {            buildConfig.setFiles( buildFileList( Arrays.asList( files ) ) );        }        Map javaOpts = config.getCompilerOptions();        if ( javaOpts != null && !javaOpts.isEmpty() )        {            buildConfig.setJavaOptions( javaOpts );        }        List cp = new LinkedList( config.getClasspathEntries() );        cp.add( 0, System.getProperty( "java.home" ) + "/lib/rt.jar" );        checkForAspectJRT( cp );        if ( cp != null && !cp.isEmpty() )        {            buildConfig.setClasspath( cp );        }        String outputLocation = config.getOutputLocation();        if ( outputLocation != null )        {            File outDir = new File( outputLocation );            if ( !outDir.exists() )            {                outDir.mkdirs();            }            buildConfig.setOutputDir( outDir );        }        if ( config instanceof AspectJCompilerConfiguration )        {            AspectJCompilerConfiguration ajCfg = (AspectJCompilerConfiguration) config;            Map sourcePathResources = ajCfg.getSourcePathResources();            if ( sourcePathResources != null && !sourcePathResources.isEmpty() )            {                buildConfig.setSourcePathResources( sourcePathResources );            }            Map ajOptions = ajCfg.getAJOptions();            if ( ajOptions != null && !ajOptions.isEmpty() )            {                buildConfig.setAjOptions( ajCfg.getAJOptions() );            }            List aspectPath = buildFileList( ajCfg.getAspectPath() );            if ( aspectPath != null && !aspectPath.isEmpty() )            {                buildConfig.setAspectpath( buildFileList( ajCfg.getAspectPath() ) );            }            List inJars = buildFileList( ajCfg.getInJars() );            if ( inJars != null && !inJars.isEmpty() )            {                buildConfig.setInJars( buildFileList( ajCfg.getInJars() ) );            }            List inPaths = buildFileList( ajCfg.getInPath() );            if ( inPaths != null && !inPaths.isEmpty() )            {                buildConfig.setInPath( buildFileList( ajCfg.getInPath() ) );            }            String outJar = ajCfg.getOutputJar();            if ( outJar != null )            {                buildConfig.setOutputJar( new File( ajCfg.getOutputJar() ) );            }        }        MessageHandler messageHandler = new MessageHandler();        AjBuildManager manager = new AjBuildManager( messageHandler );        boolean success = manager.batchBuild( buildConfig, messageHandler );                // We need the location of the maven so we have a couple of options        // here.        //        // The aspectjrt jar is something this component needs to function so we        // can either        // bake it into the plugin and retrieve it somehow or use a system        // property or we        // could pass in a set of parameters in a Map.                boolean errors = messageHandler.hasAnyMessage( IMessage.ERROR, true );        if ( errors )        {            IMessage[] errorMessages = messageHandler.getMessages( IMessage.ERROR, true );            for ( int i = 0; i < errorMessages.length; i++ )            {                IMessage m = errorMessages[i];                messages.add( new CompilerError( m.getSourceLocation().getSourceFile().getPath(),                                                 true, m.getSourceLocation().getLine(),                                                 m.getSourceLocation().getColumn(),                                                 m.getSourceLocation().getEndLine(),                                                 m.getSourceLocation().getColumn(), m.getMessage() ) );            }        }        return messages;    }