Package org.apache.maven.plugin.eclipse

Examples of org.apache.maven.plugin.eclipse.EclipseConfigFile


    {
        if ( additionalConfig != null )
        {
            for ( int j = 0; j < additionalConfig.length; j++ )
            {
                EclipseConfigFile file = additionalConfig[j];
                File projectRelativeFile = new File( eclipseProjectDir, file.getName() );
                if ( projectRelativeFile.isDirectory() )
                {
                    // just ignore?
                    getLog().warn( Messages.getString( "EclipsePlugin.foundadir", //$NON-NLS-1$
                                                       projectRelativeFile.getAbsolutePath() ) );
                }

                try
                {
                    projectRelativeFile.getParentFile().mkdirs();
                    if ( file.getContent() == null )
                    {
                        InputStream inStream;
                        if ( file.getLocation() != null )
                        {
                            inStream = locator.getResourceAsInputStream( file.getLocation() );
                        }
                        else
                        {
                            inStream = file.getURL().openConnection().getInputStream();
                        }
                        OutputStream outStream = new FileOutputStream( projectRelativeFile );
                        try
                        {
                            IOUtil.copy( inStream, outStream );
                        }
                        finally
                        {
                            inStream.close();
                            outStream.close();
                        }
                    }
                    else
                    {
                        FileUtils.fileWrite( projectRelativeFile.getAbsolutePath(), file.getContent() );
                    }
                }
                catch ( IOException e )
                {
                    throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantwritetofile", //$NON-NLS-1$
                                                                          projectRelativeFile.getAbsolutePath() ) );
                }
                catch ( ResourceNotFoundException e )
                {
                    throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantfindresource", //$NON-NLS-1$
                                                                          file.getLocation() ) );
                }

            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.eclipse.EclipseConfigFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.