persistence@glassfish.java.net

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

From: Wonseok Kim <guruwons_at_gmail.com>
Date: Thu, 15 Feb 2007 09:56:11 +0900

I checked in the fix.
https://glassfish.dev.java.net/issues/show_bug.cgi?id=2405
https://glassfish.dev.java.net/issues/show_bug.cgi?id=2409

This will be reflected from the next build(b37).
I hope Marina to address the maven issues - groupId issue and when to start
publishing promoted builds.

Also, we need to notify developers and users about the versioning change and
the agent integration.
I have a plan to post a blog entry for this after b37.

Cheers,
-Wonseok

On 2/15/07, Marina Vatkina <Marina.Vatkina_at_sun.com> wrote:
>
> Hi Wonseok,
>
> It is good that you moved the classes output to the build/classes because
> now
> it'd be easier to fix issue
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=1257 and leave
> modified
> Version.java around to see what's there later on.
>
> thanks,
> -marina
>
> Wonseok Kim wrote:
> > Hi Tom,
> >
> > In addition, I refactored build.xml script to remove redundancy in
> > "assemble" and "jar" targets. Both are building jar files and composing
> > MANIFEST files on its own. So, I merged the common jobs into "package"
> > target and modified other parts accordingly.
> >
> > Summary of the fix
> > * Merge the similar tasks from "assemble" and "jar" target into new
> > "package" target. "package" target makes jar bundles in build/release
> dir.
> > * "assemble" target update the glassfish images(glassfish/lib/*) from
> > the artifacts of the "package" target.
> > * Renamed "jar" target to "dist" target which generates binary and
> > source bundles in build/release. I think this target can be used
> > frequently, so renamed it to more meangingful name.
> > * classes output dir is changed from build to build/classes because
> > other artifacts are being generated in build directory(e.g.
> > build/release, build/maven-repo).
> >
> > Before this fix, artifacts of GlassFish build(by build target) and
> > Stand-alone build(by jar target) were different a little bit(in
> > MANIFEST). I synchronized the build process of two. As a side effect,
> > normal build will always generate binaries in build/release also. I
> > think it's good because I don't need to go to the glassfish directory to
> > find the artifacts.
> >
> > Also, I found that the "build" directory is under CVS. There is no
> > reason to put it under CVS, so I will remove it from the repository.
> >
> > Tom, with this refactoring it become difficult to separate the commit
> > transaction of the two issues(versioning change and agent integration).
> > Could I check-in this fix in one commit transaction?
> >
> > Thanks,
> > -Wonseok
> >
> > Here is a diff of some files: (full diff and modified files are in the
> > attached file)
> >
> > Index: entity-persistence/build.properties
> > ===================================================================
> > RCS file: /cvs/glassfish/entity-persistence/build.properties,v
> > retrieving revision 1.2
> > diff -c -w -r1.2 build.properties
> > *** entity-persistence/build.properties 13 May 2006 01:34:16
> -0000 1.2
> > --- entity-persistence/build.properties 14 Feb 2007 12:15:46 -0000
> > ***************
> > *** 21,32 ****
> >
> > ### Component Properties ###
> > src.dir=src/java
> > ! component.classes.dir=build
> > ! maven.netbeans.exec.build=build
> >
> > ### 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
> >
> > --- 21,35 ----
> >
> > ### Component Properties ###
> > src.dir=src/java
> > ! build.dir=build
> > ! component.classes.dir=build/classes
> > ! maven.netbeans.exec.build=build/classes
> >
> > ### 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
> > +
> >
> release.toplink-essentials.src.zip=${release.dir}/toplink-essentials.src.zip
> > +
> >
> release.toplink-essentials-agent.src.zip=${release.dir}/toplink-essentials-agent.src.zip
> >
> >
> > Index: entity-persistence/build.xml
> > ===================================================================
> > RCS file: /cvs/glassfish/entity-persistence/build.xml,v
> > retrieving revision 1.17
> > diff -c -w -r1.17 build.xml
> > *** entity-persistence/build.xml 4 Oct 2006 17:16:54 -0000 1.17
> > --- entity-persistence/build.xml 14 Feb 2007 12:15: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"
> > ***************
> > *** 68,73 ****
> > --- 76,86 ----
> > description="Build entire component">
> > </target>
> >
> > + <!-- release -->
> > + <target name="dist" depends="init, package, package-src"
> > + description="Build and make distribution bundles">
> > + </target>
> > +
> > <!-- init. Initialization involves creating publishing directories
> and
> > OS specific targets. -->
> > <target name="init" description="${component.name
> > <http://component.name>} initialization">
> > ***************
> > *** 75,81 ****
> > --- 88,96 ----
> > <format property="start.time" pattern="MM/dd/yyyy hh:mm
> aa"/>
> > </tstamp>
> > <echo message="Building component ${component.name
> > <http://component.name>}"/>
> > + <mkdir dir="${build.dir}"/>
> > <mkdir dir="${component.classes.dir}"/>
> > + <mkdir dir="${release.dir}"/>
> > </target>
> >
> > <!-- compile -->
> > ***************
> > *** 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"
> > --- 98,107 ----
> > 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"
> > ***************
> > *** 130,180 ****
> > </target>
> >
> > <!-- assemble -->
> > ! <target name="assemble" depends="init, copy-persistence-api"
> > description="Create TopLink Essentials jar files">
> >
> > ! <jar jarfile="${ entity-persistence.jar}">
> > ! <manifest>
> > ! <attribute name="Specification-Title" value="Java
> > Persistence API"/>
> > ! <attribute name="Specification-Vendor" value="Sun
> > Microsystems, Inc., Oracle Corp."/>
> > ! <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"/>
> > ! <include name="oracle/toplink/essentials/**/*.class"/>
> > ! <include name="oracle/toplink/libraries/**/*.class"/>
> > ! <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}"/>
> > ! </fileset>
> > ! <fileset dir="${ component.classes.dir}">
> > ! <include
> > name="${metainf.services.dir
> }/javax.persistence.spi.PersistenceProvider"/>
> > ! </fileset>
> > ! </jar>
> > !
> > ! <jar jarfile="${entity-persistence-agent.jar}">
> > ! <manifest>
> > ! <attribute name="Class-Path"
> > value="toplink-essentials.jar" />
> > ! <attribute name="Premain-Class"
> > value="
> oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializerAgent"
> > />
> > ! <attribute name="Specification-Title" value="Java
> > Persistence API"/>
> > ! <attribute name="Specification-Vendor" value="Sun
> > Microsystems, Inc., Oracle Corp."/>
> > ! <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"/>
> > ! </fileset>
> > ! </jar>
> > !
> > </target>
> >
> > <target name="copy-persistence-api" depends="init">
> > --- 148,159 ----
> > </target>
> >
> > <!-- assemble -->
> > ! <target name="assemble" depends="init, package"
> > description="Create TopLink Essentials jar files">
> >
> > ! <!-- Update GlassFish images -->
> > ! <copy file="${release.toplink-essentials.jar}"
> > tofile="${entity-persistence.jar}"/>
> > ! <copy file="${release.toplink-essentials-agent.jar}"
> > tofile="${entity-persistence-agent.jar}"/>
> > </target>
> >
> > <target name="copy-persistence-api" depends="init">
> > ***************
> > *** 195,200 ****
> > --- 174,181 ----
> > <target name="clean" depends="antlr-clean" description="Clean the
> > build">
> > <delete includeEmptyDirs="true" failonerror="false">
> > <fileset dir="${ component.classes.dir}"/>
> > + <fileset dir="${release.dir}"/>
> > + <fileset dir="${build.dir}"/>
> > </delete>
> > </target>
> >
> > ***************
> > *** 231,238 ****
> > <!-- prepare manifest files for jars -->
> > <target name="cook-manifest" depends="init"
> > description="Generate MANIFEST.MF files">
> > ! <mkdir dir="${release.dir}/manifest"/>
> > ! <copy todir="${release.dir}/manifest">
> > <fileset dir="." includes="*.mf" />
> > <filterset>
> > <filter token="VERSION" value="${release.version}"/>
> > --- 212,219 ----
> > <!-- prepare manifest files for jars -->
> > <target name="cook-manifest" depends="init"
> > description="Generate MANIFEST.MF files">
> > ! <mkdir dir="${build.dir}/manifest"/>
> > ! <copy todir="${ build.dir}/manifest">
> > <fileset dir="." includes="*.mf" />
> > <filterset>
> > <filter token="VERSION" value="${ release.version
> }"/>
> > ***************
> > *** 241,276 ****
> > </target>
> >
> > <!-- Assemble toplink-essentials.jar without updating
> > glassfish/image/lib/ -->
> > ! <target name="jar" depends="init, compile, cook-manifest">
> > ! <mkdir dir="${release.dir}"/>
> > <copy file="${glassfish.maven}/legal/CDDLv1.0.txt" tofile="${
> > release.dir}/META-INF/LICENSE.txt"/>
> > <copy
> > file="${glassfish.maven}/legal/3RD-PARTY-LICENSE-persistence.txt "
> > tofile="${release.dir}/META-INF/3RD-PARTY-LICENSE.txt"/>
> >
> > - <unjar src="${javaee.jar}" dest="${release.dir}"
> overwrite="true">
> > - <patternset>
> > - <include name="javax/persistence/**/*.class"/>
> > - </patternset>
> > - </unjar>
> > - <copy todir="${release.dir}">
> > - <fileset dir="${glassfish.schemas.home}">
> > - <include name="orm*.xsd"/>
> > - <include name="persistence*.xsd"/>
> > - </fileset>
> > - </copy>
> > -
> > <jar jarfile="${release.toplink-essentials.jar}"
> > ! manifest="${release.dir}/manifest/toplink- essentials.mf
> ">
> > ! <metainf dir="${release.dir}/META-INF"
> > ! includes="LICENSE.txt"/>
> > ! <metainf dir="${ release.dir}/META-INF"
> > ! includes="3RD-PARTY-LICENSE.txt"/>
> > <fileset dir="${component.classes.dir}">
> > <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"/>
> > <include name="orm*.xsd"/>
> > <include name="persistence*.xsd"/>
> > --- 222,240 ----
> > </target>
> >
> > <!-- Assemble toplink-essentials.jar without updating
> > glassfish/image/lib/ -->
> > ! <target name="package" depends="init, compile, cook-manifest,
> > copy-persistence-api"
> > ! description="Package binary bundle">
> > <copy file="${glassfish.maven}/legal/CDDLv1.0.txt"
> > tofile="${release.dir}/META-INF/LICENSE.txt"/>
> > <copy
> > file="${glassfish.maven}/legal/3RD-PARTY-LICENSE-persistence.txt"
> > tofile="${release.dir}/META-INF/3RD-PARTY-LICENSE.txt"/>
> >
> > <jar jarfile="${release.toplink-essentials.jar}"
> > ! manifest="${build.dir}/manifest/toplink-essentials.mf">
> > ! <metainf dir="${release.dir}/META-INF"
> > includes="LICENSE.txt"/>
> > ! <metainf dir="${release.dir}/META-INF"
> > includes="3RD-PARTY-LICENSE.txt"/>
> > <fileset dir="${ component.classes.dir}">
> > <include name="oracle/toplink/essentials/**/*.class"/>
> > <include name="oracle/toplink/libraries/**/*.class"/>
> > <include name="persistence/antlr/**/*.class"/>
> > <include name="javax/persistence/**/*.class"/>
> > <include name="orm*.xsd"/>
> > <include name="persistence*.xsd"/>
> > ***************
> > *** 283,328 ****
> > </fileset>
> > </jar>
> >
> > <jar jarfile="${release.toplink-essentials-agent.jar }"
> > !
> > manifest="${release.dir}/manifest/toplink-essentials-agent.mf">
> > ! <metainf dir="${release.dir}/META-INF"
> > ! includes="LICENSE.txt"/>
> > ! <metainf dir="${release.dir}/META-INF"
> > ! includes="3RD-PARTY-LICENSE.txt"/>
> > <fileset dir="${component.classes.dir}">
> > <include
> >
> name="oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializerAgent.class"/>
> > </fileset>
> > </jar>
> >
> > ! <zip file="${release.dir}/toplink-essentials.src.zip">
> > <fileset dir="${src.dir}">
> > <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"/>
> > </fileset>
> > ! <fileset dir="${release.dir }">
> > <include name="orm*.xsd"/>
> > <include name="persistence*.xsd"/>
> > </fileset>
> > </zip>
> >
> > ! <zip file="${release.dir}/toplink-essentials-agent.src.zip">
> > <fileset dir="${src.dir}">
> > <include
> >
> name="oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializerAgent.java"/>
> >
> > </fileset>
> > </zip>
> > </target>
> >
> > ! <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>
> > </target>
> >
> > --- 247,296 ----
> > </fileset>
> > </jar>
> >
> > + <!-- The agent jar is deprecated, but is generated for existing
> > users.
> > + ${entity-persistence.jar} now has the agent facility. -->
> > <jar jarfile="${release.toplink-essentials-agent.jar}"
> > !
> > manifest="${build.dir}/manifest/toplink-essentials-agent.mf">
> > ! <metainf dir="${ release.dir}/META-INF"
> > includes="LICENSE.txt"/>
> > ! <metainf dir="${release.dir}/META-INF" includes="
> > 3RD-PARTY-LICENSE.txt"/>
> > <fileset dir="${component.classes.dir}">
> > <include
> >
> name="oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializerAgent.class"/>
> > </fileset>
> > </jar>
> >
> > ! </target>
> > !
> > ! <target name="package-src" depends="init" description="Package
> > source bundle">
> > ! <zip file="${release.toplink-essentials.src.zip}">
> > <fileset dir="${src.dir}">
> > <include name="oracle/toplink/essentials/**/*.java"/>
> > <include name="oracle/toplink/libraries/**/*.java"/>
> > <include name="persistence/antlr/**/*.java"/>
> > </fileset>
> > <fileset dir="${basedir}/../persistence-api/src/java">
> > <include name="javax/persistence/**/*.java"/>
> > </fileset>
> > ! <fileset dir="${basedir}/../persistence-api/schemas">
> > <include name="orm*.xsd"/>
> > <include name="persistence*.xsd"/>
> > </fileset>
> > </zip>
> >
> > ! <zip file="${release.toplink-essentials-agent.src.zip}">
> > <fileset dir="${src.dir}">
> > <include
> >
> name="oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializerAgent.java"/>
> >
> > </fileset>
> > </zip>
> > </target>
> >
> > !
> > !
> > ! <target name="push-to-maven-prepare" depends="-push-to-maven-init,
> > dist"
> > 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.toplink-essentials.jar}"
> > pom="toplink-essentials.pom" srczip="${
> > release.toplink-essentials.src.zip}" />
> > ! <artifact jar="${release.toplink-essentials-agent.jar }"
> > pom="toplink-essentials-agent.pom"
> > srczip="${release.toplink-essentials-agent.src.zip}" />
> > </maven-repository-importer>
> > </target>
> >
> > Index: entity-persistence/maven.xml
> > ===================================================================
> > RCS file: /cvs/glassfish/entity-persistence/maven.xml,v
> > retrieving revision 1.1
> > diff -c -w -r1.1 maven.xml
> > *** entity-persistence/maven.xml 7 Oct 2005 06:11:25 -0000 1.1
> > --- entity-persistence/maven.xml 14 Feb 2007 12:15:46 -0000
> > ***************
> > *** 43,49 ****
> > </goal>
> >
> >
> > <goal name="makejar">
> > ! <j:set var="ant.target" value="jar" />
> > <j:set var="module.dir" value="./" />
> > <attainGoal name="invoke-ant"/>
> > </goal>
> > --- 43,49 ----
> > </goal>
> >
> >
> > <goal name="makejar">
> > ! <j:set var="ant.target" value="dist" />
> > <j:set var="module.dir" value="./" />
> > <attainGoal name="invoke-ant"/>
> > </goal>
> >
> >
> >
> > On 2/13/07, *Wonseok Kim* <guruwons_at_gmail.com
> > <mailto:guruwons_at_gmail.com>> wrote:
> >
> > 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
> >
> >
>