You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Petar Tahchiev (JIRA)" <ji...@apache.org> on 2016/08/11 19:05:20 UTC
[jira] [Commented] (ARCHETYPE-505)
archetype:create-from-project,the .gitignore file not copy to
archetype-resources
[ https://issues.apache.org/jira/browse/ARCHETYPE-505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15417755#comment-15417755 ]
Petar Tahchiev commented on ARCHETYPE-505:
------------------------------------------
I'm not sure we can fix this. We are adding the defaultExcludes from the {{DirectoryScanner}}:
https://github.com/apache/maven-archetype/blob/master/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java#L834
which is in the plexus-utils and it includes the {{.gitignore}} file (correctly IMHO):
https://codehaus-plexus.github.io/plexus-utils/apidocs/org/codehaus/plexus/util/AbstractScanner.html
> archetype:create-from-project,the .gitignore file not copy to archetype-resources
> ---------------------------------------------------------------------------------
>
> Key: ARCHETYPE-505
> URL: https://issues.apache.org/jira/browse/ARCHETYPE-505
> Project: Maven Archetype
> Issue Type: Bug
> Components: Archetypes
> Affects Versions: 2.4
> Environment: maven 3.3 ,maven-archetype-plugin 2.4
> Reporter: feilong
> Attachments: webapp-springmvc32.zip
>
>
> I have a very simple maven test project for {{archetype:create-from-project}}
> such as :(you can download from the Attachment)
> {noformat}
> | .gitignore
> | pom.xml
> |
> \---src
> +---main
> | \---java
> | overview.html
> |
> \---test
> {noformat}
> only {{.gitignore}} and {{pom.xml}}, and {{overview.html}} files
> and I excute the command line in the root folder:
> {code:xml}
> mvn -X archetype:create-from-project
> {code}
> I see ,in the {{target\generated-sources\archetype\src\main\resources\archetype-resources}} folder, only
> {noformat}
> | pom.xml
> |
> \---src
> \---main
> \---java
> overview.html
> {noformat}
> no {{.gitignore}} file
> ----
> first , I search the same issue in jira, there is #ARCHETYPE-474 , but not as my scene
> ----
> I search some solution in stackoverflow
> http://stackoverflow.com/questions/7981060/maven-archetype-plugin-doesnt-let-resources-in-archetype-resources-through#answer-37322323
> In pom.xml,I have also configed that
> {code:xml}
> <plugin>
> <artifactId>maven-resources-plugin</artifactId>
> <version>3.0.1</version>
> <configuration>
> <encoding>utf-8</encoding>
> <includeEmptyDirs>true</includeEmptyDirs>
> <addDefaultExcludes>false</addDefaultExcludes>
> </configuration>
> <executions>
> <execution>
> <id>default-resources</id>
> <phase>process-resources</phase>
> <goals>
> <goal>resources</goal>
> </goals>
> <configuration>
> <detail>true</detail>
> </configuration>
> </execution>
> <execution>
> <id>default-testResources</id>
> <phase>process-test-resources</phase>
> <goals>
> <goal>testResources</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> {code}
> {{maven-resources-plugin}} set {{addDefaultExcludes}} attribute to {{false}}
> but does't work
> ----
> so, I look for the maven-archetype source code in github https://github.com/apache/maven-archetype
> the org.apache.maven.archetype.creator.FilesetArchetypeCreator.*createArchetypeFiles*(Properties, List<FileSet>, String, File, File, String) method
> line 796 show that:
> {code:title=FilesetArchetypeCreator.java|borderStyle=solid}
> private void createArchetypeFiles( Properties reverseProperties, List<FileSet> fileSets, String packageName,
> File basedir, File archetypeFilesDirectory, String defaultEncoding )
> throws IOException
> {
> getLogger().debug( "Creating Archetype/Module files from " + basedir + " to " + archetypeFilesDirectory );
> for ( FileSet fileSet : fileSets )
> {
> DirectoryScanner scanner = new DirectoryScanner();
> scanner.setBasedir( basedir );
> scanner.setIncludes( (String[]) concatenateToList( fileSet.getIncludes(), fileSet.getDirectory() ).toArray(
> new String[fileSet.getIncludes().size()] ) );
> scanner.setExcludes( (String[]) fileSet.getExcludes().toArray( new String[fileSet.getExcludes().size()] ) );
> scanner.addDefaultExcludes();
> getLogger().debug( "Using fileset " + fileSet );
> scanner.scan();
> List<String> fileSetResources = Arrays.asList( scanner.getIncludedFiles() );
> getLogger().debug( "Scanned " + fileSetResources.size() + " resources" );
>
> .....
> {code}
> here is {{scanner.addDefaultExcludes();}}
> So , the result log show that :
> {noformat}
> [DEBUG] Creating Archetype/Module files from C:\Users\feilong\feilong\feilong-archetypes\0726-232539 to C:\Users\feilong\feilong\feilong-archetypes\0726-232539\
> target\generated-sources\archetype\src\main\resources\archetype-resources
> [DEBUG] Using fileset src/main/java (Copied-Flat) [**/*.html -- ]
> [DEBUG] Scanned 1 resources
> [DEBUG] Package as Directory: Package:com.baozun.store->com\baozun\store
> [DEBUG] InputFileName:src\main\java\overview.html
> [DEBUG] OutputFileName:src\main\java\overview.html
> [DEBUG] Copied src/main/java files
> [DEBUG] Using fileset (Copied-Flat) [.gitignore -- ]
> [DEBUG] Scanned 0 resources
> [DEBUG] Package as Directory: Package:com.baozun.store->com\baozun\store
> [DEBUG] Copied files
> [DEBUG] Created files for webapp-springmvc3
> {noformat}
> when scan {{.gitignore}} , {{Scanned 0 resources}}
> ----
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)