You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Rob Evans (JIRA)" <ji...@codehaus.org> on 2008/03/07 09:08:29 UTC

[jira] Commented: (ARCHETYPE-146) Archetype Resources not being processed on Windows.

    [ http://jira.codehaus.org/browse/ARCHETYPE-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_126419 ] 

Rob Evans commented on ARCHETYPE-146:
-------------------------------------

I can't seem to get a patch created but here's a fix. Look for the comment // START FIX


public class DefaultArchetype
    extends AbstractLogEnabled
    implements Archetype
{

... 

private void zipper( ZipOutputStream zos,
                         int offset,
                         File currentSourceDirectory )
        throws IOException
    {
        File[] files = currentSourceDirectory.listFiles();

        for ( int i = 0; i < files.length; i++ )
        {
            if ( files[i].isDirectory() )
            {
                zipper( zos, offset, files[i] );
            }
            else
            {

            	
            	
                String fileName = files[i].getAbsolutePath().substring( offset + 1 );

               // START FIX
                if(files[i].separatorChar != '/'){
                	fileName = fileName.replace('\\', '/');
                }
              // END FIX 
                
                ZipEntry e = new ZipEntry( fileName );

                zos.putNextEntry( e );

                FileInputStream is = new FileInputStream( files[i] );

                byte[] buf = new byte[4096];

                int n;

                while ( ( n = is.read( buf ) ) > 0 )
                {
                    zos.write( buf, 0, n );
                }

                is.close();

                zos.flush();

                zos.closeEntry();
            }
        }
    }
...
}

> Archetype Resources not being processed on Windows. 
> ----------------------------------------------------
>
>                 Key: ARCHETYPE-146
>                 URL: http://jira.codehaus.org/browse/ARCHETYPE-146
>             Project: Maven Archetype
>          Issue Type: Bug
>          Components: Archetypes
>    Affects Versions: 2.0-alpha-2
>         Environment: Windows XP 
>            Reporter: Rob Evans
>
> We created an archetype, built and installed it on a windows machine. When we used it on the same machine, the project was created but did not have the src/ directory. When we built it on a unix system and ran it on a windows box it worked properly. 
> Looks like a problem processing the resources. Maybe a path issue? 
> $ mvn --version
> Maven version: 2.0.7
> Java version: 1.6.0_02
> OS name: "windows xp" version: "5.1" arch: "x86"
> Define value for package: : d
> Confirm properties configuration:
> groupId: d
> artifactId: d
> version: d
> package: d
>  Y: :
> [DEBUG] OldArchetype generation configuration confirmed
> [DEBUG] archetype.cci.struts: using locally installed snapshot
> [DEBUG] archetype.cci.struts: using locally installed snapshot
> [DEBUG] No found META-INF/maven/archetype-metadata.xml retrying with windows path
> [DEBUG] archetype.cci.struts: using locally installed snapshot
> [DEBUG] No found META-INF/maven/archetype-metadata.xml retrying with windows path
> [DEBUG] Found resource archetype-resources\pom.xml
> [DEBUG] Found resource archetype-resources\src\main\webapp\index.jsp
> [DEBUG] Found resource archetype-resources\src\main\webapp\WEB-INF\web.xml
> [DEBUG] Not resource META-INF\maven\archetype-metadata.xml
> [DEBUG] Not resource META-INF\maven\archetype.xml
> [DEBUG] Processing complete archetype app
> [DEBUG] Processing d
> [DEBUG] Processing pom C:\DOCUME~1\robevans\NX73F8~1\temp\d\pom.xml
> [DEBUG] Prosessing template archetype-resources\pom.xml
> [DEBUG] Merging into C:\DOCUME~1\robevans\NX73F8~1\temp\d\pom.xml
> [DEBUG] Processing filesets
> [DEBUG] Processing fileset src/main/webapp (Filtered-Flat) [**/*.jsp, **/*.xml -- ]
> []
> [archetype-resources\pom.xml, archetype-resources\src\main\webapp\index.jsp, archetype-resources\src\main\webapp\WEB-INF\web.xml]
> [DEBUG] Processed 0 files
> [DEBUG] Processed d
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 11 seconds
> [INFO] Finished at: Thu Mar 06 21:05:31 GMT-02:00 2008
> [INFO] Final Memory: 7M/13M
> [INFO] ------------------------------------------------------------------------

-- 
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