Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.4
-
None
-
None
-
maven 3.3 ,maven-archetype-plugin 2.4
Description
I have a very simple maven test project for archetype:create-from-project
such as :(you can download from the Attachment)
| .gitignore | pom.xml | \---src +---main | \---java | overview.html | \---test
only .gitignore and pom.xml, and overview.html files
and I excute the command line in the root folder:
mvn -X archetype:create-from-project
I see ,in the target\generated-sources\archetype\src\main\resources\archetype-resources folder, only
| pom.xml | \---src \---main \---java overview.html
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
<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>
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:
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" ); .....
here is scanner.addDefaultExcludes();
So , the result log show that :
[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
when scan .gitignore , Scanned 0 resources
Attachments
Attachments
Issue Links
- is duplicated by
-
ARCHETYPE-603 archetype:create-from-project is not copying .gitignore file to archetype
- Closed