David,

 

Yes I agree with you, but for this version of the plugin I won’t add patterns yet since I’m reworking the plugin.

 

Matt

 

After some digging around, hibernate by default can find hbm.xml files that are part of a jar, but no annotated classes. For that you either have to use

mapping class or mapping package and hibernate would be able to find the annotated classes. I see that you specify the annotated classes in the the spring configuration, why not move it to configuration.xml and point spring to that file?

 

Either way I’ll keep looking for a solution

 

Regards

 

Johann Reyes

 


From: David Bernard [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 07, 2006 7:04 PM
To: [email protected]
Subject: Re: [mojo-dev] hibernate3 plugin - scanning for annotations in JARs

 

Johann,

I am not sure that it is safe to process all dependency jars as there may be junk left over in dependencies that will cause unexpected consequences.

Perhaps "include" "exclude" patterns that cover file names both in the build directory and in the JARs (if includeJars set) would cover this case.

This would allow a series of packages to be built following a naming/packaging convention. These packages could be assembled into applications
in different combinations through dependencies. Fine grain control with includes and excludes would allow specific classes from a package to be include
with others in the same package excluded.


Matt,


My work around is as follows (see below):

1. Use a hibernate.cfg.xml to identify the required classes which is packaged with the "model" package.
2. In the "service-impl" package pom upack the "model" package with the dependency plugin and run the hibernate3 plugin against it.

Issues:
Don't really handle multiple "model" case. Could unpack into target/class and let the hibernate plugin scan(?). This would


Cheers

David Bernard


      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>dependency-maven-plugin</artifactId>
        <executions>
          <!-- Extract the model-hibernate module for access
               to the Hibernate mapping files -->
          <execution>
          <phase>generate-test-resources</phase>
          <goals>
          <goal>unpack</goal>
          </goals>
          <configuration>
            <artifactItems>
              <artifactItem>
                <groupId>com.xxxxx.yyyyyy</groupId>
                <artifactId>model-hibernate</artifactId>
                <version>1.0-SNAPSHOT</version>
                <type>jar</type>
                <outputDirectory>src/test/resources</outputDirectory>
              </artifactItem>
            </artifactItems>
          </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
          <groupId>org.codehaus.mojo</groupId>
           <artifactId>hibernate3-maven-plugin</artifactId>
           <configuration>
             <hibernate>
               <propertyFile>../src/test/resources/database.properties</propertyFile>
               <configurationFile>src/test/resources/hibernate.cfg.xml</configurationFile>
              </hibernate>
            </configuration>
            <executions>
              <!-- Generate DB schema from annotated classes identified in hibernate.cfg.xml and
                apply schema to database -->
              <execution>
                <id>Generate and Apply DB Schema</id>
                <phase>process-test-resources</phase>
                <goals>
                  <goal>schema-update</goal>
                </goals>
                <configuration>
                  <drop>false</drop>
                  <update>false</update>
                </configuration>
              </execution>
            </executions>
            <dependencies>
              <!-- required for postgresql -->
              <dependency>
                <groupId>postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>8.1-404.jdbc3</version>
              </dependency>
            </dependencies>
          </plugin>
 
 

David Bernard 


Matt Raible wrote:

It looks like it is included:

[DEBUG] added to hibernate classpath: C:\Documents and
Settings\mraible\.m2\repository\org\appfuse\appfuse-data-common\2.0-SNAPSHOT\appfuse-data-common-2.0-SNAPSHOT.jar

I've attached the full output from mvn -X - hopefully this mailing
list allows attachments.

Matt

On 11/7/06, Johann Reyes <[EMAIL PROTECTED]> wrote:

Hello Matt

Can you run the plugin with the -X parameter and see if the jar that you are
looking for is getting include?

Also if you sent me the output it can help me to debug it better.

Regards

Johann Reyes

-----Original Message-----
From: Matt Raible [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 07, 2006 4:58 PM
To: [email protected]
Subject: Re: [mojo-dev] hibernate3 plugin - scanning for annotations in JARs

I still get the same error. Here's my plugin configuration:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>hibernate3-maven-plugin</artifactId>
                <configuration>
                    <hibernate>

<propertyFile>target/test-classes/database.properties</propertyFile>
                        <includeJars>true</includeJars>
                    </hibernate>
                    <update>true</update>
                </configuration>
                <executions>
                    <execution>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>hbm2ddl</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>${jdbc.groupId}</groupId>
                        <artifactId>${jdbc.artifactId}</artifactId>
                        <version>${jdbc.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

I tried moving <includeJars>true</includeJars> to just below
</hibernate>, but that didn't work either.

Matt

On 11/7/06, Johann Reyes <[EMAIL PROTECTED]> wrote:
> Hello Matt
>
> Well, I've just added support for it. It might be temporary, since the new
> version of the plugin is different to the one in subversion now.
>
> It's already deployed as a snapshot, let me know how it works.
>
> Regards
>
> Johann Reyes
>
>
> - Configuration:
>
> <configuration>
>   <hibernate>
>     <includeJars>true</includeJars>
>   </hibernate>
> </configuration>
>
>
> -----Original Message-----
> From: Matt Raible [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 07, 2006 10:25 AM
> To: [email protected]
> Subject: [mojo-dev] hibernate3 plugin - scanning for annotations in JARs
>
> Currently, it seems the hibernate3 plugin scans the target directory
> of the current project, but not the JARs of any dependencies[1].  In
> AppFuse, we have our model objects in a separate artifacts/JAR so they
> can be used by multiple persistence frameworks.
>
> Is the scanning of JARs a feature you plan to add?
>
> Thanks,
>
> Matt
>
> [1] http://issues.appfuse.org/browse/APF-519
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


--
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email




---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email




 


 
---------------------------------------------------------------------
To unsubscribe from this list please visit:
 
    http://xircles.codehaus.org/manage_email

 

Reply via email to