You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by cowwoc <co...@bbs.darktech.org> on 2010/06/18 01:41:51 UTC

Exporting Ant properties to Maven

Hi,

Could someone please explain how to export properties defined in an Ant
block into Maven?
http://stackoverflow.com/questions/3066252/exporting-maven-properties-from-ant-code

Basically I'm trying to ensure that ${basedir} contains unix-style slashes
under Windows and this is the only way I knew how to do it. Is there a
better way?

Thanks,
Gili
-- 
View this message in context: http://maven.40175.n5.nabble.com/Exporting-Ant-properties-to-Maven-tp510023p510023.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Exporting Ant properties to Maven

Posted by Daniel Kulp <dk...@apache.org>.

Hmm...   the gmaven things looks like a good idea.  I may need to investigate 
it a bit more.

The solution that the Camel folks came up with was to have antrun write the 
properties out to a file (in target), and then use the properties-maven-plugin 
(at mojo) to load the properties file.   Seems to work, but that's two 
plugins.    If things can be done with gmaven in one, that might be simpler.

Dan


On Friday 18 June 2010 9:08:20 am lukewpatterson wrote:
> not sure how to with antrun, here's a way with gmaven/ant:
> 
> http://pastebin.com/XsAdbbcY
> 
> two commands of interest:
> 
> mvn initialize - you'll see that the property gets changed to the value
> retrieved from ant
> 
> mvn help:effective-pom - if you look at the project name, just a
> reinforcement that if you explicitly use the property in your pom, it gets
> eagerly resolved

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

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


Re: pom version neede in a java class to log it

Posted by Justin Edelson <ju...@gmail.com>.
On 6/18/10 11:54 AM, Antonio Petrelli wrote:
> 2010/6/18 Varwig, Britta <br...@sap.com>:
>> I think there is a plugin which can copy the actual pom version to a target\resource-file, but I can not remember the name of plugin.
>> Thanks for your hint.
> 
> It is done by the jar plugin (or other packaging plugins) by
> configuring the manifest part:
> <plugin>
> 	<groupId>org.apache.maven.plugins</groupId>
> 	<artifactId>maven-jar-plugin</artifactId>
> 	<version>2.3</version>
> 	<configuration>
> 		<archive>
>          			<manifest>
>            				<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
>          			</manifest>
>        			</archive>
> 	</configuration>
> </plugin>
> 
> So you can read "Implementation-Version" property it from the manifest itself.
> 
> Antonio
> 
An alternative to this is to use resource filtering to create a
properties (or other text) file in the target directory with
${pom.version} replaced with the version.

Justin

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


Re: pom version neede in a java class to log it

Posted by Antonio Petrelli <an...@gmail.com>.
2010/6/18 Varwig, Britta <br...@sap.com>:
> I think there is a plugin which can copy the actual pom version to a target\resource-file, but I can not remember the name of plugin.
> Thanks for your hint.

It is done by the jar plugin (or other packaging plugins) by
configuring the manifest part:
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-jar-plugin</artifactId>
	<version>2.3</version>
	<configuration>
		<archive>
         			<manifest>
           				<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
         			</manifest>
       			</archive>
	</configuration>
</plugin>

So you can read "Implementation-Version" property it from the manifest itself.

Antonio

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


pom version neede in a java class to log it

Posted by "Varwig, Britta" <br...@sap.com>.
Hello, 
I would like log the actual project.version from one of my java classes. 
How can access it from in my java class?

I think there is a plugin which can copy the actual pom version to a target\resource-file, but I can not remember the name of plugin. 
Thanks for your hint.


Regards Britta


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


Re: Exporting Ant properties to Maven

Posted by cowwoc <co...@bbs.darktech.org>.

lukewpatterson wrote:
> 
> not sure how to with antrun, here's a way with gmaven/ant:
> 
> http://pastebin.com/XsAdbbcY
> 
> two commands of interest:
> 
> mvn initialize - you'll see that the property gets changed to the value
> retrieved from ant
> 
> mvn help:effective-pom - if you look at the project name, just a
> reinforcement that if you explicitly use the property in your pom, it gets
> eagerly resolved
> 

I'll check this out but is there a way to ensure that ${basedir} uses
unix-style slashes without having to resort to Ant?

Thanks,
Gili
-- 
View this message in context: http://maven.40175.n5.nabble.com/Exporting-Ant-properties-to-Maven-tp510023p510124.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Exporting Ant properties to Maven

Posted by lukewpatterson <lu...@gmail.com>.
not sure how to with antrun, here's a way with gmaven/ant:

http://pastebin.com/XsAdbbcY

two commands of interest:

mvn initialize - you'll see that the property gets changed to the value
retrieved from ant

mvn help:effective-pom - if you look at the project name, just a
reinforcement that if you explicitly use the property in your pom, it gets
eagerly resolved
-- 
View this message in context: http://maven.40175.n5.nabble.com/Exporting-Ant-properties-to-Maven-tp510023p510117.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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