yeah, it works! __artifactId__ and __rootArtifactId__ all works well
but this way bring a new little problem: my archetype is come from a
demo project using archetype:create-from-project,now i get a archetype
and change some directory's name to __artifactId__,later i want to make
some tuning on the demo project and call mvn
archetype:create-from-project again, then i have to rename those
directory's name again.
do you have any suggestions ? why not the archetype plugin put the java
sources into right path directly?
在 2014-08-18 19:25, Hervé BOUTEMY 写道:
ah ok
so you don't need a custom plugin to add artifactId: just put content in a
directory named __artifactId__
see
http://stackoverflow.com/questions/6378589/how-to-rename-a-directory-with-the-artifactid-when-using-a-maven-archetype
Regards,
Hervé
Le lundi 18 août 2014 17:00:36 TOM a écrit :
i think i got it,i debuged archetype:generate and found code like this
DefaultFilesetArchetypeGenerator.java
private File getOutputFile( String template, String directory, File
outputDirectoryFile, boolean packaged,
String packageName, String
moduleOffset, Context context )
{
String templateName = StringUtils.replaceOnce( template,
directory, "" );
String outputFileName =
directory + "/" + ( packaged ? getPackageAsDirectory(
packageName ) : "" ) + "/" + templateName.substring(
moduleOffset.length() );
if ( TOKEN_PATTERN.matcher( outputFileName ).matches() )
{
outputFileName = replaceFilenameTokens( outputFileName,
context );
}
return new File( outputDirectoryFile, outputFileName );
}
so maybe archetype plugin doesn't intend deal with the artifactId in the
path,am i right?
i wrote a plugin to adjust file path myself
在 2014-08-18 15:54, Hervé BOUTEMY 写道:
ok, need to investigate
can you create a Jira issue and attach an example project?
Regards,
Hervé
Le lundi 18 août 2014 10:01:16 TOM a écrit :
thank you ,but my descriptor already is packaged= true
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
在 2014-08-18 0:10, Hervé BOUTEMY 写道:
use packaged="true" [1]
Regards,
Hervé
[1]
http://maven.apache.org/archetype/archetype-models/archetype-descriptor/
a
rchetype-descriptor.html>
Le mardi 12 août 2014 16:58:53 TOM a écrit :
I use mvn archetype:create-from-project to generate a archetype
project.
and use it to generate a project
the content of archetype file UserDTO(generaged by
archetype:create-from-project)
package ${package}.${artifactId}.dto;
then i mvn archetype:generate -DarchetypeArtifactId=myapp
-DgroupId=test
-DartifactId=good
then the generated UserDTO with correct package(package test.good.dto),
but it is in src/main/java/test/dto , not expected
src/main/java/test/good/dto
please help me and thank a lot
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org