dev@glassfish.java.net

Re: [Fwd: Review for pom changes - was [Re: Need to have *.xsd files from javax.persistence.jar under lib/schemas]]

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Fri, 12 Jun 2009 11:28:40 -0700

Reminder #2 - Can one of the pom reviewers please review these changes.

Thanks,
Mietsh

Mitesh Meswani wrote:
> Can one of pom reviewers please review the change.
>
> Thanks,
> Mitesh
>
> -------- Original Message --------
> Subject: Review for pom changes - was [Re: Need to have *.xsd
> files from javax.persistence.jar under lib/schemas]
> Date: Wed, 10 Jun 2009 11:10:40 -0700
> From: Mitesh Meswani <mitesh.meswani_at_sun.com>
> To: Snjezana Sevo-Zenzerovic <Snjezana.Sevo-Zenzerovic_at_Sun.COM>
> CC: Jane Young <Jane.Young_at_Sun.COM>, Jerome Dochez
> <Jerome.Dochez_at_Sun.COM>, sahoo_at_sun.com
> References: <4A296019.6090003_at_sun.com> <4A29814B.6060607_at_sun.com>
> <4A298310.7050302_at_sun.com> <4A2983DD.3000400_at_sun.com>
> <4A298BA8.9040802_at_sun.com> <4A2D5F4C.6030405_at_sun.com>
> <4A2D63D9.2050705_at_sun.com> <4A2DB656.50001_at_sun.com>
> <4A2EA3AF.3060705_at_sun.com> <4A2EB26E.8070506_at_sun.com>
> <4A2EFB9A.6030609_at_sun.com>
>
>
>
> Adding Sahoo....
>
> Can one of you please review the changes.
>
> Thanks,
> Mitesh
>
> Mitesh Meswani wrote:
>> Hi Jane, Snjezana,
>>
>> It is not possible to follow the approach below because the jar
>> cooked up by us is overwritten in package phase by jar:jar. A better
>> approach is to not attempt to cook up the jar at all and let maven do
>> it. Attached are changes to implement that. I have verified that it
>> produces correct result with a full build and quicklook passes. Can
>> you please review.
>>
>> summary of changes:
>> Top level pom
>> -Added entry for javax.persistence under dependencyManagement section
>> in top level pom
>>
>> deployment/schemas/pom.xml
>> -Extracting persistence xsds from javax.persistence.jar from EclipseLink
>> -Stopped cooking up schemas.jar
>> -Copying above xsds under classes so that default jar plugin picks it
>> up.
>>
>> $ svn diff pom.xml
>> Index: pom.xml
>> ===================================================================
>> --- pom.xml (revision 27777)
>> +++ pom.xml (working copy)
>> @@ -765,6 +765,12 @@
>> <version>${schema2beans.version}</version>
>> </dependency>
>>
>> + <dependency>
>> +
>> <groupId>org.eclipse.persistence</groupId>
>> +
>> <artifactId>javax.persistence</artifactId>
>> +
>> <version>${javax-persistence-api.version}</version>
>> + </dependency>
>> +
>> <dependency>
>> <groupId>org.eclipse.persistence</groupId>
>> <artifactId>org.eclipse.persistence.core</artifactId>
>>
>> --------------------------------------------------------------------------------------------------------------------------------------
>>
>> svn diff deployment/schemas/pom.xml
>> Index: deployment/schemas/pom.xml
>> ===================================================================
>> --- deployment/schemas/pom.xml (revision 27777)
>> +++ deployment/schemas/pom.xml (working copy)
>> @@ -11,20 +11,51 @@
>> <packaging>distribution-fragment</packaging>
>> <name>Set of schemas for Java EE</name>
>> - <build>
>> + <properties>
>> +
>> <jpa.schema.temp.location>${project.build.directory}/jpaSchemaFiles</jpa.schema.temp.location>
>>
>> + </properties>
>> + <build>
>> <plugins>
>> - <plugin>
>> + <plugin>
>> + <groupId>org.apache.maven.plugins</groupId>
>> + <artifactId>maven-dependency-plugin</artifactId>
>> + <executions>
>> + <execution>
>> + <id>unpack</id>
>> + <goals>
>> + <goal>unpack</goal> <!-- bids to
>> process-sources phase by default -->
>> + </goals>
>> + <!--
>> + Extract orm*.xsd and persistence*.xsd into a
>> temp location from javax.persistence.jar.
>> + The files would be extracted as
>> javax/persistence/{file} under the location.
>> + It is not possible to specify to exclude
>> javax/persistence prefix while extracting the file.
>> + The ant task below would copy the files
>> under classes/glassfish/lib/schemas so that it
>> + can be picked up in packaging phase.
>> + -->
>> + <configuration>
>> + <artifactItems>
>> + <artifactItem>
>> + <groupId>org.eclipse.persistence</groupId>
>> + <artifactId>javax.persistence</artifactId>
>> + <includes>javax/persistence/orm*.xsd,
>> javax/persistence/persistence*.xsd</includes>
>> +
>> <outputDirectory>${jpa.schema.temp.location}</outputDirectory>
>> + </artifactItem>
>> + </artifactItems>
>> + </configuration>
>> + </execution>
>> + </executions>
>> + </plugin>
>> + <plugin>
>>
>> <groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
>> <artifactId>maven-antrun-extended-plugin</artifactId>
>> <executions>
>> <execution>
>> - <phase>compile</phase>
>> + <phase>process-resources</phase>
>> <configuration>
>> <tasks>
>> - <jar file="target/schemas.jar">
>> - <fileset
>> dir="src/main/resources" />
>> - </jar>
>> - <attachArtifact
>> file="target/schemas.jar" type="jar" classifier="resources" />
>> + <copy
>> todir="${project.build.directory}/classes/glassfish/lib/schemas"
>> flatten="true">
>> + <fileset
>> dir="${jpa.schema.temp.location}/javax/persistence"/>
>> + </copy>
>> </tasks>
>> </configuration>
>> <goals>
>> @@ -47,4 +78,5 @@
>> </extension>
>> </extensions>
>> </build>
>> + </project>
>>
>>
>> Thanks,
>> Mitesh
>>
>> Mitesh Meswani wrote:
>>> Hi Snjezana,
>>>
>>> I had a chat with Jerome (He was hungry hading out for lunch. So it
>>> was quick ;) ). He is ok with reorganizing the layout. I would go
>>> ahead and make the changes.
>>>
>>> Thanks,
>>> Mitesh
>>>
>>> Snjezana Sevo-Zenzerovic wrote:
>>>> Mitesh,
>>>>
>>>> this looks OK to me, but you might also want to run it by Jerome
>>>> and Sahoo. I personally don't have particular opinion on
>>>> reorganization of the module file layout as long as I get correct
>>>> file layout in resulting distribution fragment jar :-)
>>>>
>>>> Thanks,
>>>>
>>>> Snjezana
>>>>
>>>> Mitesh Meswani wrote:
>>>>
>>>>> Hi Snjezana, Jane,
>>>>>
>>>>> Sorry, I misunderstood your initial reply. Attached are the
>>>>> proposed changes to deployment/schemas/pom.xml. The change
>>>>> extracts the schema files from javax.persitence.jar and bundles
>>>>> then into the schemas.jar created. Can you please take a look to
>>>>> check I am not completely on a tangent.
>>>>>
>>>>> Things still to do before checkin
>>>>> 1. Remove persistence*.xsd and orm*.xsd from under
>>>>> src/main/resources/glassfish/lib/schemas
>>>>> 2 Test with a full build that things actually work :)
>>>>> 3. I think we should move
>>>>> src/main/resources/glassfish/lib/schemas/* to src/main/resources/
>>>>> and use the zipfileset.prefix (see the attached change that does
>>>>> it for javax/persistsence/*.xsd) to create dir structure inside
>>>>> schemas.jar. This would help consolidate the prefix at one place
>>>>> instead of being implies by dir structure under src/main/resources
>>>>> and pom. What do you think?
>>>>>
>>>>> Thanks,
>>>>> Mitesh
>>>>>
>>>>> Snjezana Sevo-Zenzerovic wrote:
>>>>>
>>>>>> Mitesh,
>>>>>>
>>>>>> no, you do not have to check the files into SVN in order to
>>>>>> create distribution fragment module. As I mentioned below, you
>>>>>> should in that case add custom step to extract them from the jar
>>>>>> in deployment/schemas/pom.xml or build.xml file. In any case,
>>>>>> this should not be handled on packager level, but in separate
>>>>>> distribution fragment module since we should avoid custom
>>>>>> packaging steps.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Snjezana
>>>>>>
>>>>>> Mitesh Meswani wrote:
>>>>>>
>>>>>>> Hi Snjezna,
>>>>>>>
>>>>>>> Thanks for the suggestions. As Jane has already pointed out,
>>>>>>> both the approaches suggested by you would lead us to check in
>>>>>>> the xsd files in out repo. Ideally we would want to retrieve
>>>>>>> these files at packaging time from javax.persistence.jar that we
>>>>>>> pull in from EclipseLink. What do you think?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Mitesh
>>>>>>>
>>>>>>> Jane Young wrote:
>>>>>>>
>>>>>>>> Hi Snjezana,
>>>>>>>>
>>>>>>>> Thanks for the suggetions. These files are currently bundled
>>>>>>>> in javax.persitence.jar and pulled from EclipseLink maven
>>>>>>>> repository. Do we want to commit these files in our SVN
>>>>>>>> repo? I rather stay away from committing 3rd party files in
>>>>>>>> our SVN repo.
>>>>>>>> Thanks,
>>>>>>>> Jane
>>>>>>>>
>>>>>>>>
>>>>>>>> Snjezana Sevo-Zenzerovic wrote:
>>>>>>>>
>>>>>>>>> Another possilibility would be to simply add these files to
>>>>>>>>> existing deployment/schemas module. In that case you just need
>>>>>>>>> to either checkin files into SVN (if they are not changing) or
>>>>>>>>> add custom step to extract them from the jar in
>>>>>>>>> deployment/schemas/pom.xml or build.xml
>>>>>>>>>
>>>>>>>>> Snjezana Sevo-Zenzerovic wrote:
>>>>>>>>>
>>>>>>>>>> Mitesh,
>>>>>>>>>>
>>>>>>>>>> somewhere under persistence should create separate module of
>>>>>>>>>> distribution-fragment type, stage these files there and then
>>>>>>>>>> reference that module as dependency in appropriate packager
>>>>>>>>>> module pom.xml (packager/glassfish-common/pom.xml if they
>>>>>>>>>> need to be collocated with javax.persistence.jar).
>>>>>>>>>>
>>>>>>>>>> You can take a look at something like deployment/dtds to see
>>>>>>>>>> an example of distribution-fragment module.
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>>
>>>>>>>>>> Snjezana
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Jane Young wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi Mitesh,
>>>>>>>>>>>
>>>>>>>>>>> This would be part of packaging.
>>>>>>>>>>>
>>>>>>>>>>> I see that javax.persistence.jar is bundled in
>>>>>>>>>>> glassfish-common.zip. So in packager/glassfish-common
>>>>>>>>>>> module, the xsd files could be extracted and put in the
>>>>>>>>>>> stage/glassfishv3/glassfish/lib/schemas directory.
>>>>>>>>>>>
>>>>>>>>>>> cc'ing Snjezana to see if she has other suggestions.
>>>>>>>>>>>
>>>>>>>>>>> Thanks
>>>>>>>>>>> Jane
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Mitesh Meswani wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi Jane,
>>>>>>>>>>>>
>>>>>>>>>>>> We need to include following files from
>>>>>>>>>>>> javax.persitence.jar that we pull in from EclipseLink under
>>>>>>>>>>>> glassfish/lib/schemas of a GlassFish installation. How do
>>>>>>>>>>>> we achieve this?
>>>>>>>>>>>>
>>>>>>>>>>>> avax/persistence/orm_1_0.xsd
>>>>>>>>>>>> javax/persistence/orm_2_0.xsd
>>>>>>>>>>>> javax/persistence/persistence_1_0.xsd
>>>>>>>>>>>> javax/persistence/persistence_2_0.xsd
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks,
>>>>>>>>>>>> Mitesh
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>>
>>>>> Index: pom.xml
>>>>> ===================================================================
>>>>> --- pom.xml (revision 27728)
>>>>> +++ pom.xml (working copy)
>>>>> @@ -11,9 +11,36 @@
>>>>> <packaging>distribution-fragment</packaging>
>>>>> <name>Set of schemas for Java EE</name>
>>>>> - <build>
>>>>> + <properties>
>>>>> +
>>>>> <glassfish.lib.schemas>glassfish/lib/schemas</glassfish.lib.schemas>
>>>>> +
>>>>> <jpa.schema.temp.location>${project.build.directory}/jpaSchemaFiles</jpa.schema.temp.location>
>>>>>
>>>>> + </properties>
>>>>> + <build>
>>>>> <plugins>
>>>>> - <plugin>
>>>>> + <plugin>
>>>>> + <groupId>org.apache.maven.plugins</groupId>
>>>>> + <artifactId>maven-dependency-plugin</artifactId>
>>>>> + <executions>
>>>>> + <execution>
>>>>> + <id>unpack</id> + <goals>
>>>>> + <goal>unpack</goal> <!-- bids to
>>>>> process-sources phase by default -->
>>>>> + </goals>
>>>>> + <!-- Extract orm*.xsd and persistence*.xsd
>>>>> into a temp location from javax.persistence.jar -->
>>>>> + <configuration>
>>>>> + <artifactItems>
>>>>> + <artifactItem>
>>>>> +
>>>>> <groupId>org.eclipse.persistence</groupId>
>>>>> +
>>>>> <artifactId>javax.persistence</artifactId>
>>>>> + <includes>javax/persistence/orm*.xsd,
>>>>> javax/persistence/persistence*.xsd</includes>
>>>>> +
>>>>> <outputDirectory>${jpa.schema.temp.location}</outputDirectory>
>>>>> + </artifactItem>
>>>>> + </artifactItems>
>>>>> + </configuration>
>>>>> + </execution>
>>>>> + </executions>
>>>>> + </plugin>
>>>>> + <plugin>
>>>>>
>>>>> <groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
>>>>> <artifactId>maven-antrun-extended-plugin</artifactId>
>>>>> <executions>
>>>>> @@ -23,6 +50,7 @@
>>>>> <tasks>
>>>>> <jar file="target/schemas.jar">
>>>>> <fileset
>>>>> dir="src/main/resources" />
>>>>> + <zipfileset
>>>>> dir="${jpa.schema.temp.location}/javax/persistence"
>>>>> prefix="${glassfish.lib.schemas}"/>
>>>>> </jar>
>>>>> <attachArtifact
>>>>> file="target/schemas.jar" type="jar" classifier="resources" />
>>>>> </tasks>
>>>>> @@ -47,4 +75,5 @@
>>>>> </extension>
>>>>> </extensions>
>>>>> </build>
>>>>> + </project>
>>>>>
>>>>>
>>>>
>>>
>>
>
>