maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TOM <tom.w...@embracesource.com>
Subject Re: hi, I just want to get help about maven archetype,please help me
Date Fri, 29 Aug 2014 02:37:49 GMT
i can't, i think this parameter is used for generated whole archetype 
project but this is not i need.


在 2014-08-21 1:51, Martin Gainty 写道:
>
>> Date: Wed, 20 Aug 2014 10:57:48 +0800
>> From: tom.wang@embracesource.com
>> To: users@maven.apache.org
>> Subject: Re: hi, I just want to get help about maven archetype,please help me
>>
>> 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.
> MG>can you not specify outputDirectory from archetype:create-project for your new
outputDirectory?
> MG>http://maven.apache.org/archetype/maven-archetype-plugin/create-from-project-mojo.html
>
>> 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-unsubscribe@maven.apache.org
>>>>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>   		 	   		




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message