You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Thomas Colin de Verdière <td...@scort.com> on 2007/03/01 10:57:39 UTC

Re: Filtering resources

Thanks you very much it will be good this way.

Thomas

Brad Szabo a écrit :
> You can still do all of the Ant work inside of an Ant build file, just
> call the <ant> task, and before you do, you can specify any properties
> that you want to be available to Ant, such as:
>
> <configuration>
>     <tasks>
>         <property name="project.build.directory"
> value="${project.build.directory}"/>
>         <property name="settings.localRepository"
> value="${settings.localRepository}"/>
>
>         <ant antFile="${basedir}/ant-tasks.xml" target="some.target"
> inheritAll="true" inheritRefs="true"/>
>     </tasks>
> </configuration>
>
> Note- Be sure inheritAll="true" or you will need to specify the
> properties as child elements of the <ant> task.
>
> Good luck,
> -Brad
>
> On Wed, 2007-02-28 at 18:44 +0100, Thomas Colin de Verdière wrote:
>   
>> I was using it because i then want to extract files using Ant (you think 
>> it's ugly) and then merge some jars together. Suppress the version number.
>> And also merge some files that have the same name into the jars.
>> We thought about assemblies but they can't do the last file merging stuff.
>> And in the Ant file we first tried to use artifact:dependencies Ant tags 
>> but then we get all the transitive dependency (we can't break the 
>> chain). not the artifact alone.
>> Ok now i see the solution is to launch ant inside the pom .., i have to 
>> convince my colleague which is not a very pro maven user :)
>>
>> Thank you,
>> Thomas
>>
>> Brad Szabo a écrit :
>>     
>>> Ah. The Maven Resources Plugin only supports filtering using system
>>> properties, project properties, and properties defined in filter
>>> resources.
>>>
>>> It does not appear that settings properties are available, which
>>> actually makes sense now that I think about it. I do not think that this
>>> is a bug. Settings properties are not included because they are user
>>> specific. You would not want that information being filtered into the
>>> project artifact.
>>>
>>> Why exactly are you trying to generate a build.properties file for
>>> inclusion in the project artifact?
>>>
>>> -Brad
>>>
>>>
>>> On Wed, 2007-02-28 at 17:13 +0100, Thomas Colin de Verdière wrote:
>>>   
>>>       
>>>> It works.. it echoes the string.
>>>> Here is the part for resources :
>>>>     <resources>
>>>>       <resource>
>>>>         <directory>buildproperties</directory>
>>>>         <filtering>true</filtering>
>>>>       </resource>
>>>>     </resources>
>>>>
>>>> And in the buildproperties directory here is the build.properties file 
>>>> to filter :
>>>> MAVEN_REPO=${settings.mirrors}
>>>> MAVEN_REPO=${project.class.name}
>>>> MAVEN_REPO=${settings.localRepository}
>>>> MAVEN_REPO=${localRepository.class.name}
>>>> MAVEN_REPO2=${myrepository}
>>>>
>>>> and it really does generate the file into \target\classes as :
>>>> MAVEN_REPO=${settings.mirrors}
>>>> MAVEN_REPO=org.apache.maven.project.MavenProject
>>>> MAVEN_REPO=${settings.localRepository}
>>>> MAVEN_REPO=org.apache.maven.project.MavenProject
>>>> MAVEN_REPO2=${settings.localRepository}
>>>>
>>>> Thanks Brad.
>>>>
>>>> Brad Szabo a écrit :
>>>>     
>>>>         
>>>>> Can you elaborate a little on where you are trying to use
>>>>> ${settings.localRepository}. 
>>>>>
>>>>> If you add the following AntRun plugin to your pom.xml to echo the
>>>>> expression value, does it not display the proper path to your local
>>>>> repository?
>>>>>
>>>>>
>>>>>           <plugin>
>>>>>               <artifactId>maven-antrun-plugin</artifactId>
>>>>>               <executions>
>>>>>                   <execution>
>>>>>                     <phase>validate</phase>
>>>>>                     <configuration>
>>>>>                       <tasks>
>>>>>                           <echo message="settings.localRepository: ${settings.localRepository}"/>
>>>>>                       </tasks>
>>>>>                     </configuration>
>>>>>                     <goals>
>>>>>                         <goal>run</goal>
>>>>>                     </goals>
>>>>>                   </execution>
>>>>>               </executions>
>>>>>           </plugin>
>>>>>
>>>>>
>>>>> Run 'mvn validate' to check the output.
>>>>>
>>>>> -Brad
>>>>>
>>>>>
>>>>> On Wed, 2007-02-28 at 16:25 +0100, Thomas Colin de Verdière wrote:
>>>>>   
>>>>>       
>>>>>           
>>>>>> Yes i downloaded Maven 2.0.5
>>>>>>
>>>>>> Brad Szabo a écrit :
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>>> You are using Maven 2 right?
>>>>>>>
>>>>>>> On Wed, 2007-02-28 at 15:40 +0100, Thomas Colin de Verdière wrote:
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>               
>>>>>>>> Thanks but i tried and it didn't work. You are right it is written in 
>>>>>>>> the document on the maven site. ..
>>>>>>>>
>>>>>>>> Brad Szabo a écrit :
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>>>                 
>>>>>>>>> The localRepository property is configured in settings.xml, therefore
>>>>>>>>> you can access it using ${settings.localRepository}. (The default is
>>>>>>>>> ~/.m2/repository). 
>>>>>>>>>
>>>>>>>>> Hope this helps,
>>>>>>>>> -Brad
>>>>>>>>>
>>>>>>>>> References:
>>>>>>>>> http://maven.apache.org/guides/mini/guide-configuring-maven.html
>>>>>>>>> http://maven.apache.org/settings.html
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, 2007-02-28 at 10:39 +0100, Thomas Colin de Verdière wrote:
>>>>>>>>>   
>>>>>>>>>       
>>>>>>>>>           
>>>>>>>>>               
>>>>>>>>>                   
>>>>>>>>>> Hello,
>>>>>>>>>> i try to filter resources in my project to generate a build.properties file.
>>>>>>>>>> I would like to have the path to the localRepository. So i use 
>>>>>>>>>> ${localRepository} as it is said in "BetterBuilds with Maven" but it 
>>>>>>>>>> doesn't work.
>>>>>>>>>> I tried the following properties for testing :
>>>>>>>>>> MAVEN_REPO=${project.class.name}
>>>>>>>>>> MAVEN_REPO=${localRepository}
>>>>>>>>>> MAVEN_REPO=${localRepository.class.name}
>>>>>>>>>>
>>>>>>>>>> and here is the result :
>>>>>>>>>> MAVEN_REPO=org.apache.maven.project.MavenProject
>>>>>>>>>> MAVEN_REPO=${localRepository}
>>>>>>>>>> MAVEN_REPO=org.apache.maven.project.MavenProject
>>>>>>>>>>
>>>>>>>>>> So the localRepository seems to be a 
>>>>>>>>>> org.apache.maven.project.MavenProject  ??
>>>>>>>>>>
>>>>>>>>>> Thanks for helping,
>>>>>>>>>> Thomas
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> 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
>>>
>>>
>>>   
>>>       
>> ---------------------------------------------------------------------
>> 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