ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Jackson" <foamd...@gmail.com>
Subject OT - Maven woes
Date Fri, 15 Sep 2006 04:56:58 GMT
How the hell did anyone convince anyone else to use this crap?!

With that off my chest - I *have to* use mvn2 on my current project,
anyone have experience getting maven to actually do anything useful?
I don't know maven well and I'm happy to concede that I may be a
witless luser, and if someone can hit me with a cluebat, please do,
but until that moment I have to say that my experience with mvn is
completely negative.

All I want to do is:

1 - get build time (like Ant's <tstamp>) in a particular format
2 - and write this value into the manifest of the created jar.

This should not take me 1 week and still be no closer to getting a
result.  Regardless of mavens other qualities (dependency management),
the fact that I cannot find the documentation that I need to solve
this problem, the fact that parts of the maven website are 404, the
fact that I cannot search the mailing list archives (no MARC, just
some nabble.com thing), the fact that the FAQ is missing answers...
the list of documentation problems is endless with maven - I now think
Ant's docs are fantastic.

I'm truly at my wit's end regarding such a simple task, here is what I
currently have in my pom.xml:

	<build>
		<filters>
			<filter>build.properties</filter>
		</filters>
		<resources>
			<resource>
                                <!-- required for some reason to get
filtering working -->
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>

....


<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<phase>process-classes</phase>
						<configuration>
							<tasks>
								<tstamp>
									<!-- 2006-08-19 15:32:04 -->
									<format property="last.updated" pattern="yyyy-MM-dd hh:mm:ss"/>
								</tstamp>
								<echo file="build.properties" message="build.time=${last.updated}"/>
                                                                <!--
sanity check - yep ant works fine, thankfully -->
								<echo message="[build.properties] - updated with : ${last.updated}"/>
							</tasks>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

....

<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
          			<archive>
         				<manifestEntries>
         					<!-- inserts the correct entry in the manifest, but -->
         					<!-- so far no luck on getting the build time -->
            				<Built-Time>XXX - ${build.time}</Built-Time>
         				</manifestEntries>
         			</archive>
      			</configuration>
				<executions>
					<execution>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

Basically I want to set a property build.time, and reference it later.
 As it seems that you can only specify hard-coded properties in the
pom (why oh why?!), I decided to get around this by getting ant to
spit out the correct value into a props file, then use mavens
filter/resources to pull in this new value and then reference it with
${build.time} in the appropriate place.

Of course it doesn't work due to - what, I don't know, is it the goal,
the phase that it executes in?  Basically the docs don't tell me
enough, and neither does the debug, and google-fu has failed me too.

I know some of the maven devs lurk here (from time to time), if any of
them could shed some light on this.

Do I have to write a <tstamp> plugin (mojo?) for this?

This has to be the second most frustrating piece of software I've
encountered - right after Oracle.
Kev

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message