You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Andy Seaborne <an...@apache.org> on 2012/03/28 23:20:23 UTC

Build and timestamps

On 28/03/12 22:03, Andy Seaborne wrote:
>
>>> I also get m2e errors - the antrun plugin is "not covered by lifecycle
>>> configuration"
>>>
>>
>> You can fix that by using the QuickFix suggestion and ignoring that
>> goal. That just means if you want that goal to run, you have to use
>> the command line maven [1]. Below is a diff to apply that fix to ARQ.
>> I've been debating checking this in for all the projects, as it will
>> only affect those running m2e.
>
> The alternative is to not need antrun -- it exists only to get the
> timestamp in the way that used to be recommended.
>
> Maven now has property:
> maven.build.timestamp
> which takes a format. Just the XSD format is sufficient.
>
> <maven.build.timestamp.format
>  >yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format>
>
> Andy

... which does not work.

http://jira.codehaus.org/browse/MRESOURCES-99

is still broken in maven 3.0.4.

The workaround works.

	Andy

==== arq-properties.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">

<properties version="1.0">
   <comment>ARQ System Properties</comment>
   <entry key="com.hp.hpl.jena.sparql.version">${project.version}</entry>
   <entry 
key="com.hp.hpl.jena.sparql.build.datetime">${arq.buildDateTime}</entry>
</properties>

==== POM patch:

### Eclipse Workspace Patch 1.0
#P ARQ
Index: pom.xml
===================================================================
--- pom.xml	(revision 1305900)
+++ pom.xml	(working copy)
@@ -48,6 +48,8 @@
      <ver.httpclient>4.1.2</ver.httpclient>
      <ver.httpcore>4.1.3</ver.httpcore>
      <ver.commons-codec>1.5</ver.commons-codec>
+ 
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format>
+    <arq.buildDateTime>${maven.build.timestamp}</arq.buildDateTime>
    </properties>

    <dependencies>
@@ -102,11 +104,6 @@
    </dependencies>

    <build>
-    <!-- The filter file is written by antrun -->
-    <filters>
-      <filter>${project.basedir}/target/filter.properties</filter>
-    </filters>
-
      <resources>
        <resource>
          <filtering>false</filtering>
@@ -201,39 +198,6 @@
          <artifactId>maven-resources-plugin</artifactId>
        </plugin>

-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-antrun-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>ant-timestamp</id>
-            <phase>initialize</phase>
-            <configuration>
-              <target>
-                <mkdir dir="${project.basedir}/target" />
-                <tstamp>
-                  <format property="build.time.xsd" 
pattern="yyyy-MM-dd'T'HH:mm:ssZ" />
-                  <format property="build.time.txt" pattern="yyyy-MM-dd 
HH:mm z" />
-                </tstamp>
-                <!-- Do not indent (it does not work) -->
-                <echo file="${project.basedir}/target/filter.properties">
-#begin
-build.time.xsd=${build.time.xsd}
-build.time.txt=${build.time.txt}
-#end
-                </echo>
-                <echo message="version=${project.version}" />
-                <echo message="build.time=${build.time.txt}" />
-              </target>
-            </configuration>
-            <goals>
-              <goal>run</goal>
-            </goals>
-          </execution>
-          <!-- Another task, another execution -->
-        </executions>
-      </plugin>
-
        <!--
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>

Re: Build and timestamps

Posted by Robert Vesse <rv...@yarcdata.com>.
Thanks Andy

On Mar 29, 2012, at 2:02 AM, Andy Seaborne wrote:

> On 29/03/12 08:17, Andy Seaborne wrote:
>> On 28/03/12 22:59, Robert Vesse wrote:
>>> Nice find :-)
>>> 
>>> Will stop Eclipse complaining at me so much
>>> 
>>> Rob
>> 
>> I'll take that as a "go ahead and make the changes" so I'll start to
>> sweep through the projects and remove antrun. I don't know of, or at
>> least can't recall, any places it used for anything else [*]
> 
> Done.
> 
> Core, ARQ, TDB, Fuseki, SDB.
> 
>> 
>> Andy
>> 
>> [*] There again I came a comment on some string code that said
>> "do it this way because of Java 1.3" recently.
>> 
>> [**] Bother - SDB does not build via maven but does in Eclipse.
> 
> It turns out Java7 added an abstract method above java.sql.DataSource SDB has DataSourceSDB inherits from DataSource.  Jiggling around and suppressing all warnings results in code that compiles cleanly in Java6 and Java7.
> 
> 	Andy


Re: Build and timestamps

Posted by Andy Seaborne <an...@apache.org>.
On 29/03/12 08:17, Andy Seaborne wrote:
> On 28/03/12 22:59, Robert Vesse wrote:
>> Nice find :-)
>>
>> Will stop Eclipse complaining at me so much
>>
>> Rob
>
> I'll take that as a "go ahead and make the changes" so I'll start to
> sweep through the projects and remove antrun. I don't know of, or at
> least can't recall, any places it used for anything else [*]

Done.

Core, ARQ, TDB, Fuseki, SDB.

>
> Andy
>
> [*] There again I came a comment on some string code that said
> "do it this way because of Java 1.3" recently.
>
> [**] Bother - SDB does not build via maven but does in Eclipse.

It turns out Java7 added an abstract method above java.sql.DataSource 
SDB has DataSourceSDB inherits from DataSource.  Jiggling around and 
suppressing all warnings results in code that compiles cleanly in Java6 
and Java7.

	Andy

Re: Build and timestamps

Posted by Andy Seaborne <an...@apache.org>.
On 28/03/12 22:59, Robert Vesse wrote:
> Nice find :-)
>
> Will stop Eclipse complaining at me so much
>
> Rob

I'll take that as a "go ahead and make the changes" so I'll start to 
sweep through the projects and remove antrun.  I don't know of, or at 
least can't recall, any places it used for anything else [*]

	Andy

[*] There again I came a comment on some string code that said
"do it this way because of Java 1.3" recently.

[**] Bother - SDB does not build via maven but does in Eclipse.

> On Mar 28, 2012, at 2:20 PM, Andy Seaborne wrote:
>
>> On 28/03/12 22:03, Andy Seaborne wrote:
>>>
>>>>> I also get m2e errors - the antrun plugin is "not covered by lifecycle
>>>>> configuration"
>>>>>
>>>>
>>>> You can fix that by using the QuickFix suggestion and ignoring that
>>>> goal. That just means if you want that goal to run, you have to use
>>>> the command line maven [1]. Below is a diff to apply that fix to ARQ.
>>>> I've been debating checking this in for all the projects, as it will
>>>> only affect those running m2e.
>>>
>>> The alternative is to not need antrun -- it exists only to get the
>>> timestamp in the way that used to be recommended.
>>>
>>> Maven now has property:
>>> maven.build.timestamp
>>> which takes a format. Just the XSD format is sufficient.
>>>
>>> <maven.build.timestamp.format
>>>> yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format>
>>>
>>> Andy
>>
>> ... which does not work.
>>
>> http://jira.codehaus.org/browse/MRESOURCES-99
>>
>> is still broken in maven 3.0.4.
>>
>> The workaround works.
>>
>> 	Andy
>>
>> ==== arq-properties.xml:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
>>
>> <properties version="1.0">
>>   <comment>ARQ System Properties</comment>
>>   <entry key="com.hp.hpl.jena.sparql.version">${project.version}</entry>
>>   <entry key="com.hp.hpl.jena.sparql.build.datetime">${arq.buildDateTime}</entry>
>> </properties>
>>
>> ==== POM patch:
>>
>> ### Eclipse Workspace Patch 1.0
>> #P ARQ
>> Index: pom.xml
>> ===================================================================
>> --- pom.xml	(revision 1305900)
>> +++ pom.xml	(working copy)
>> @@ -48,6 +48,8 @@
>>      <ver.httpclient>4.1.2</ver.httpclient>
>>      <ver.httpcore>4.1.3</ver.httpcore>
>>      <ver.commons-codec>1.5</ver.commons-codec>
>> +<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format>
>> +<arq.buildDateTime>${maven.build.timestamp}</arq.buildDateTime>
>>    </properties>
>>
>>    <dependencies>
>> @@ -102,11 +104,6 @@
>>    </dependencies>
>>
>>    <build>
>> -<!-- The filter file is written by antrun -->
>> -<filters>
>> -<filter>${project.basedir}/target/filter.properties</filter>
>> -</filters>
>> -
>>      <resources>
>>        <resource>
>>          <filtering>false</filtering>
>> @@ -201,39 +198,6 @@
>>          <artifactId>maven-resources-plugin</artifactId>
>>        </plugin>
>>
>> -<plugin>
>> -<groupId>org.apache.maven.plugins</groupId>
>> -<artifactId>maven-antrun-plugin</artifactId>
>> -<executions>
>> -<execution>
>> -<id>ant-timestamp</id>
>> -<phase>initialize</phase>
>> -<configuration>
>> -<target>
>> -<mkdir dir="${project.basedir}/target" />
>> -<tstamp>
>> -<format property="build.time.xsd" pattern="yyyy-MM-dd'T'HH:mm:ssZ" />
>> -<format property="build.time.txt" pattern="yyyy-MM-dd HH:mm z" />
>> -</tstamp>
>> -<!-- Do not indent (it does not work) -->
>> -<echo file="${project.basedir}/target/filter.properties">
>> -#begin
>> -build.time.xsd=${build.time.xsd}
>> -build.time.txt=${build.time.txt}
>> -#end
>> -</echo>
>> -<echo message="version=${project.version}" />
>> -<echo message="build.time=${build.time.txt}" />
>> -</target>
>> -</configuration>
>> -<goals>
>> -<goal>run</goal>
>> -</goals>
>> -</execution>
>> -<!-- Another task, another execution -->
>> -</executions>
>> -</plugin>
>> -
>>        <!--
>>        <plugin>
>>          <groupId>org.apache.maven.plugins</groupId>
>


Re: Build and timestamps

Posted by Robert Vesse <rv...@yarcdata.com>.
Nice find :-)

Will stop Eclipse complaining at me so much

Rob

On Mar 28, 2012, at 2:20 PM, Andy Seaborne wrote:

> On 28/03/12 22:03, Andy Seaborne wrote:
>> 
>>>> I also get m2e errors - the antrun plugin is "not covered by lifecycle
>>>> configuration"
>>>> 
>>> 
>>> You can fix that by using the QuickFix suggestion and ignoring that
>>> goal. That just means if you want that goal to run, you have to use
>>> the command line maven [1]. Below is a diff to apply that fix to ARQ.
>>> I've been debating checking this in for all the projects, as it will
>>> only affect those running m2e.
>> 
>> The alternative is to not need antrun -- it exists only to get the
>> timestamp in the way that used to be recommended.
>> 
>> Maven now has property:
>> maven.build.timestamp
>> which takes a format. Just the XSD format is sufficient.
>> 
>> <maven.build.timestamp.format
>> >yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format>
>> 
>> Andy
> 
> ... which does not work.
> 
> http://jira.codehaus.org/browse/MRESOURCES-99
> 
> is still broken in maven 3.0.4.
> 
> The workaround works.
> 
> 	Andy
> 
> ==== arq-properties.xml:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
> 
> <properties version="1.0">
>  <comment>ARQ System Properties</comment>
>  <entry key="com.hp.hpl.jena.sparql.version">${project.version}</entry>
>  <entry key="com.hp.hpl.jena.sparql.build.datetime">${arq.buildDateTime}</entry>
> </properties>
> 
> ==== POM patch:
> 
> ### Eclipse Workspace Patch 1.0
> #P ARQ
> Index: pom.xml
> ===================================================================
> --- pom.xml	(revision 1305900)
> +++ pom.xml	(working copy)
> @@ -48,6 +48,8 @@
>     <ver.httpclient>4.1.2</ver.httpclient>
>     <ver.httpcore>4.1.3</ver.httpcore>
>     <ver.commons-codec>1.5</ver.commons-codec>
> + <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format>
> +    <arq.buildDateTime>${maven.build.timestamp}</arq.buildDateTime>
>   </properties>
> 
>   <dependencies>
> @@ -102,11 +104,6 @@
>   </dependencies>
> 
>   <build>
> -    <!-- The filter file is written by antrun -->
> -    <filters>
> -      <filter>${project.basedir}/target/filter.properties</filter>
> -    </filters>
> -
>     <resources>
>       <resource>
>         <filtering>false</filtering>
> @@ -201,39 +198,6 @@
>         <artifactId>maven-resources-plugin</artifactId>
>       </plugin>
> 
> -      <plugin>
> -        <groupId>org.apache.maven.plugins</groupId>
> -        <artifactId>maven-antrun-plugin</artifactId>
> -        <executions>
> -          <execution>
> -            <id>ant-timestamp</id>
> -            <phase>initialize</phase>
> -            <configuration>
> -              <target>
> -                <mkdir dir="${project.basedir}/target" />
> -                <tstamp>
> -                  <format property="build.time.xsd" pattern="yyyy-MM-dd'T'HH:mm:ssZ" />
> -                  <format property="build.time.txt" pattern="yyyy-MM-dd HH:mm z" />
> -                </tstamp>
> -                <!-- Do not indent (it does not work) -->
> -                <echo file="${project.basedir}/target/filter.properties">
> -#begin
> -build.time.xsd=${build.time.xsd}
> -build.time.txt=${build.time.txt}
> -#end
> -                </echo>
> -                <echo message="version=${project.version}" />
> -                <echo message="build.time=${build.time.txt}" />
> -              </target>
> -            </configuration>
> -            <goals>
> -              <goal>run</goal>
> -            </goals>
> -          </execution>
> -          <!-- Another task, another execution -->
> -        </executions>
> -      </plugin>
> -
>       <!--
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>