persistence@glassfish.java.net

Re: Please review: changes to push new versions to maven repository

From: Wonseok Kim <guruwons_at_gmail.com>
Date: Tue, 13 Feb 2007 14:27:11 +0900

Hi Craig,

To compromise the issue, I fixed more things to my previous patch.
* The full version will be like 2.0-b35 or 2.0-SNAPSHOT which does not
include datestamp. This is used in POM.
* The "Implementation-Version" entry of MANIFEST.MF will have the full
version and a build datestamp like "2.0-b35 (02/12/2007) or
2.0-SNAPSHOT(02/12/2007)" for more information.
* The version string of the runtime which is printed in logs will also
include the date timestamp like below.
[TopLink Info]: 2007.02.13 01:50:01.198--ServerSession(25062038)--TopLink,
version: Oracle TopLink Essentials - 2.0 (Build b35 (02/12/2007))

* One more thing is done to consolidate the agent class into
toplink-essentials.jar. Which can be used as an java agent instead of
toplink-essentials-agent.jar file. It still generates the agent jar file for
existing users. I think we can remove it later(GFv3?) after some campaign.

Team members, Please review the diff and the attached file.
Thanks,
-Wonseok

Index: build.xml
===================================================================
RCS file: /cvs/glassfish/entity-persistence/build.xml,v
retrieving revision 1.17
diff -c -w -r1.17 build.xml
*** build.xml 4 Oct 2006 17:16:54 -0000 1.17
--- build.xml 13 Feb 2007 04:59:46 -0000
***************
*** 48,62 ****

      &commonBuild;

      <tstamp>
         <format property="build_date" pattern="MM/dd/yyyy"/>
      </tstamp>
! <condition property="build_string" value="${build_id}">
          <not>
              <equals arg1="${build_id}" arg2="" trim="true"/>
          </not>
      </condition>
! <property name="build_string" value="non promoted: ${build_date}"/>

      <!-- all -->
      <target name="all" depends="compile, assemble"
--- 48,70 ----

      &commonBuild;

+ <!-- versioning -->
+ <!-- ${build_id} will be given by the build system. Manual build is
SNAPSHOT -->
      <tstamp>
         <format property="build_date" pattern="MM/dd/yyyy"/>
      </tstamp>
! <condition property="build_number" value="${build_id}">
          <not>
+ <or>
                  <equals arg1="${build_id}" arg2="" trim="true"/>
+ <equals arg1="${build_id}" arg2="local" trim="true"/>
+ </or>
          </not>
      </condition>
! <property name="build_number" value="SNAPSHOT"/>
! <property name="build_number_string" value="${build_number}
(${build_date})"/>
! <property name="full_version" value="${release.version
}-${build_number}"/>
! <property name="full_version_string" value="${full_version}
(${build_date})"/>

      <!-- all -->
      <target name="all" depends="compile, assemble"
***************
*** 83,89 ****
              description="Compile TopLink Essentials sources">
           <copy file="${src.dir}/oracle/toplink/essentials/Version.java"
                tofile="${component.classes.dir
}/oracle/toplink/essentials/Version.java"/>
! <replace
file="${component.classes.dir}/oracle/toplink/essentials/Version.java"
token="ESSENTIALS_BUILD_NUMBER" value="${build_string}"/>
          <javac srcdir="${component.classes.dir}"
                 destdir="${component.classes.dir}"
                 includes="oracle/toplink/essentials/Version.java"
--- 91,100 ----
              description="Compile TopLink Essentials sources">
          <copy file="${src.dir}/oracle/toplink/essentials/Version.java"
                tofile="${component.classes.dir
}/oracle/toplink/essentials/Version.java"/>
! <replace file="${component.classes.dir
}/oracle/toplink/essentials/Version.java">
! <replacefilter token="@VERSION@" value="${release.version}"/>
! <replacefilter token="@BUILD_NUMBER@"
value="${build_number_string}"/>
! </replace>
          <javac srcdir="${component.classes.dir}"
                 destdir="${component.classes.dir}"
                 includes="oracle/toplink/essentials/Version.java"
***************
*** 140,146 ****
                  <attribute name="Specification-Version" value="1.0"/>
                  <attribute name="Implementation-Title" value="TopLink
Essentials"/>
                  <attribute name="Implementation-Vendor" value="Sun
Microsystems, Inc., Oracle Corp."/>
! <attribute name="Implementation-Version" value="9.1 build:
${build_string}"/>
              </manifest>
              <fileset dir="${component.classes.dir}">
                  <include name="javax/persistence/**/*.class"/>
--- 151,158 ----
                  <attribute name="Specification-Version" value="1.0"/>
                  <attribute name="Implementation-Title" value="TopLink
Essentials"/>
                  <attribute name="Implementation-Vendor" value="Sun
Microsystems, Inc., Oracle Corp."/>
! <attribute name="Implementation-Version"
value="${full_version_string}"/>
! <attribute name="Premain-Class" value="
oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializerAgent" />
              </manifest>
              <fileset dir="${component.classes.dir}">
                  <include name="javax/persistence/**/*.class"/>
***************
*** 149,155 ****
                  <include name="orm*.xsd"/>
                  <include name="persistence*.xsd"/>
                  <include name="persistence/antlr/**/*.class"/>
- <exclude
name="oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializerAgent.class"/>
              </fileset>
              <fileset dir="${component.classes.dir}">
                  <include name="${platform.mapping.file}"/>
--- 161,166 ----
***************
*** 159,164 ****
--- 170,177 ----
              </fileset>
          </jar>

+ <!-- The agent jar is deprecated, but is generated for old version
users.
+ ${entity-persistence.jar} now has the agent facility. -->
          <jar jarfile="${entity-persistence-agent.jar}">
              <manifest>
                  <attribute name="Class-Path" value="toplink-essentials.jar"
/>
***************
*** 168,174 ****
                  <attribute name="Specification-Version" value="1.0"/>
                  <attribute name="Implementation-Title" value="TopLink
Essentials "/>
                  <attribute name="Implementation-Vendor" value="Sun
Microsystems, Inc., Oracle Corp."/>
! <attribute name="Implementation-Version" value="9.1 build:
${build_string}"/>
              </manifest>
              <fileset dir="${component.classes.dir}">
                  <include
name="oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializerAgent.class"/>
--- 181,187 ----
                  <attribute name="Specification-Version" value="1.0"/>
                  <attribute name="Implementation-Title" value="TopLink
Essentials "/>
                  <attribute name="Implementation-Vendor" value="Sun
Microsystems, Inc., Oracle Corp."/>
! <attribute name="Implementation-Version"
value="${full_version_string}"/>
              </manifest>
              <fileset dir="${component.classes.dir}">
                  <include
name="oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializerAgent.class"/>
***************
*** 235,241 ****
          <copy todir="${release.dir}/manifest">
              <fileset dir="." includes="*.mf" />
              <filterset>
! <filter token="VERSION" value="${release.version}"/>
              </filterset>
          </copy>
      </target>
--- 248,254 ----
          <copy todir="${release.dir}/manifest">
              <fileset dir="." includes="*.mf" />
              <filterset>
! <filter token="VERSION" value="${full_version_string}"/>
              </filterset>
          </copy>
      </target>
***************
*** 268,274 ****
                  <include name="oracle/toplink/essentials/**/*.class"/>
                  <include name="oracle/toplink/libraries/**/*.class"/>
                  <include name="persistence/antlr/**/*.class"/>
- <exclude
name="oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializerAgent.class"/>
              </fileset>
              <fileset dir="${release.dir}">
                  <include name="javax/persistence/**/*.class"/>
--- 281,286 ----
***************
*** 299,305 ****
                <include name="oracle/toplink/essentials/**/*.java"/>
                <include name="oracle/toplink/libraries/**/*.java"/>
                <include name="persistence/antlr/**/*.java"/>
- <exclude
name="oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializerAgent.java"/>
            </fileset>
            <fileset dir="${basedir}/../persistence-api/src/java">
                <include name="javax/persistence/**/*.java"/>
--- 311,316 ----
***************
*** 320,326 ****
      <target name="push-to-maven-prepare" depends="-push-to-maven-init,
jar"
          description="creates an image for the 'push-to-maven' goal">
          <delete dir="build/maven-repo" /><!-- clean it -->
! <maven-repository-importer destdir="build/maven-repo" version="${
release.version}">
              <artifact jar="${release.dir}/toplink-essentials.jar" pom="
toplink-essentials.pom" srczip="${release.dir}/toplink-essentials.src.zip"
/>
              <artifact jar="${release.dir}/toplink-essentials-agent.jar"
pom="toplink-essentials-agent.pom" srczip="${release.dir}/toplink-
essentials-agent.src.zip" />
          </maven-repository-importer>
--- 331,337 ----
      <target name="push-to-maven-prepare" depends="-push-to-maven-init,
jar"
          description="creates an image for the 'push-to-maven' goal">
          <delete dir="build/maven-repo" /><!-- clean it -->
! <maven-repository-importer destdir="build/maven-repo"
version="${full_version}">
              <artifact jar="${release.dir}/toplink-essentials.jar" pom="
toplink-essentials.pom" srczip="${release.dir}/toplink-essentials.src.zip"
/>
              <artifact jar="${release.dir}/toplink-essentials-agent.jar"
pom="toplink-essentials-agent.pom" srczip="${release.dir}/toplink-
essentials-agent.src.zip" />
          </maven-repository-importer>
Index: build.properties
===================================================================
RCS file: /cvs/glassfish/entity-persistence/build.properties,v
retrieving revision 1.2
diff -c -w -r1.2 build.properties
*** build.properties 13 May 2006 01:34:16 -0000 1.2
--- build.properties 13 Feb 2007 04:59:46 -0000
***************
*** 26,32 ****

  ### Additonal Component Properties for standalone release ###
  release.dir=build/release
! release.version=1.0
  release.toplink-essentials.jar=${release.dir}/toplink-essentials.jar

release.toplink-essentials-agent.jar=${release.dir}/toplink-essentials-agent.jar

--- 26,32 ----

  ### Additonal Component Properties for standalone release ###
  release.dir=build/release
! release.version=2.0
  release.toplink-essentials.jar=${release.dir}/toplink-essentials.jar

release.toplink-essentials-agent.jar=${release.dir}/toplink-essentials-agent.jar

Index: toplink-essentials.mf
===================================================================
RCS file: /cvs/glassfish/entity-persistence/toplink-essentials.mf,v
retrieving revision 1.1
diff -c -w -r1.1 toplink-essentials.mf
*** toplink-essentials.mf 13 May 2006 01:34:15 -0000 1.1
--- toplink-essentials.mf 13 Feb 2007 04:59:46 -0000
***************
*** 1,8 ****
  Extension-Name: javax.persistence
! Specification-Title: Java Platform, Persistence Specification
! Specification-Version: @VERSION@
  Specification-Vendor: Sun Microsystems, Inc., Oracle Corp.
! Implementation-Version: @VERSION@
  Implementation-Vendor: Sun Microsystems, Inc., Oracle Corp.
  Implementation-Vendor-Id: oracle.toplink.essentials
! Implementation-Title: Sun Java System Application Server
--- 1,9 ----
  Extension-Name: javax.persistence
! Specification-Title: Java Persistence API
! Specification-Version: 1.0
  Specification-Vendor: Sun Microsystems, Inc., Oracle Corp.
! Implementation-Title: TopLink Essentials
  Implementation-Vendor: Sun Microsystems, Inc., Oracle Corp.
  Implementation-Vendor-Id: oracle.toplink.essentials
! Implementation-Version: @VERSION@
! Premain-Class:
oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializerAgent
Index: toplink-essentials-agent.mf
===================================================================
RCS file: /cvs/glassfish/entity-persistence/toplink-essentials-agent.mf,v
retrieving revision 1.2
diff -c -w -r1.2 toplink-essentials-agent.mf
*** toplink-essentials-agent.mf 16 May 2006 01:01:27 -0000 1.2
--- toplink-essentials-agent.mf 13 Feb 2007 04:59:46 -0000
***************
*** 1,9 ****
  Extension-Name: oracle.toplink.essentials.agent
! Specification-Title: Java Platform, Persistence Specification
! Specification-Version: @VERSION@
  Specification-Vendor: Sun Microsystems, Inc., Oracle Corp.
! Implementation-Version: @VERSION@
  Implementation-Vendor: Sun Microsystems, Inc., Oracle Corp.
  Implementation-Vendor-Id: oracle.toplink
! Implementation-Title: Sun Java System Application Server
  Premain-Class:
oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializerAgent
--- 1,9 ----
  Extension-Name: oracle.toplink.essentials.agent
! Specification-Title: Java Persistence API
! Specification-Version: 1.0
  Specification-Vendor: Sun Microsystems, Inc., Oracle Corp.
! Implementation-Title: TopLink Essentials
  Implementation-Vendor: Sun Microsystems, Inc., Oracle Corp.
  Implementation-Vendor-Id: oracle.toplink
! Implementation-Version: @VERSION@
  Premain-Class:
oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializerAgent
Index: src/java/oracle/toplink/essentials/Version.java
===================================================================
RCS file:
/cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/Version.java,v
retrieving revision 1.47
diff -c -w -r1.47 Version.java
*** src/java/oracle/toplink/essentials/Version.java 4 Jan 2007 14:30:28
-0000 1.47
--- src/java/oracle/toplink/essentials/Version.java 13 Feb 2007 04:59:46
-0000
***************
*** 36,43 ****
      // The current version of TopLink.
      // This will be used by all product components and included in
exceptions.
      private static String product = "Oracle TopLink Essentials";
! private static final String version = "9.1";
! private static final String buildNumber = "ESSENTIALS_BUILD_NUMBER";

      /** Keep track of JDK version in order to make some decisions about
datastructures. **/
      public static final int JDK_VERSION_NOT_SET = 0;
--- 36,43 ----
      // The current version of TopLink.
      // This will be used by all product components and included in
exceptions.
      private static String product = "Oracle TopLink Essentials";
! private static final String version = "@VERSION@";
! private static final String buildNumber = "@BUILD_NUMBER@";

      /** Keep track of JDK version in order to make some decisions about
datastructures. **/
      public static final int JDK_VERSION_NOT_SET = 0;


On 2/13/07, Craig L Russell <Craig.Russell_at_sun.com> wrote:
>
> As I understand the way maven works, having both SNAPSHOT and a date stamp
> is wrong.
> In fact, having both a build number and SNAPSHOT is wrong.
>
> What SNAPSHOT does on the maven client side is to ask maven to download a
> new version of the software each time it's invoked without the -o (offline)
> option. So it makes sense to create a 2.0-SNAPSHOT.jar to represent all of
> the working versions of the 2.0-in-process jars that you build. But if you
> publish a 2.0-b56-SNAPSHOT, and the next version is 2.0-b57-SNAPSHOT, the
> user will have to declare a dependency on the specific version. That is,
> either 2.0-b56-SNAPSHOT or 2.0-b57-SNAPSHOT. And there is no point in
> declaring a dependency on a specific build number as a SNAPSHOT since it
> will never be refreshed.
>
> To effectively use SNAPSHOT, it should simply be 2.0-SNAPSHOT. When you
> refresh the repository, you typically publish both 2.0-b57 and
> 2.0-SNAPSHOT, which are the identical file. When you then publish 2.0-b58and
> 2.0-SNAPSHOT, folks who depend on the 2.0-SNAPSHOT will get the new file,
> folks who want specifically 2.0-b57 will never see the new download, and
> if folks want the new stuff but nothing beyond it, they ask for 2.0-b58.
>
> Craig
>
> On Feb 12, 2007, at 5:37 PM, Wonseok Kim wrote:
>
> That is what is being discussed. Until then, it's a manual process. Also,
> > SNAPSHOT is not an automated push unless every nightly build pushes the
> > update out.
> >
> > So may be we should use 2 versions of the full-version - one with the
> > date, and
> > one without. What do you think?
>
>
> I hope that it become part of automated process soon.
> We have an option to use date both for the two versions like
> 2.0-b35-20070212 and 2.0-SNAPSHOT-20070212. I'm not sure this is required.
> If anyone have better idea, please tell ASAP.
>
> Thanks,
> -Wonseok
>
>
> Craig Russell
>
> Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
>
> 408 276-5638 mailto:Craig.Russell_at_sun.com <Craig.Russell_at_sun.com>
>
> P.S. A good JDO? O, Gasp!
>
>
>