You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Francesco Chicchiriccò <il...@apache.org> on 2012/01/13 14:08:18 UTC

Using 2.2.0-SNAPSHOT maven plugin

Hi all,
I am currently using OpenJPA 2.2.0-SNAPSHOT, so plugin is configured as
follows:

            <plugin>
                <groupId>org.apache.openjpa</groupId>
                <artifactId>openjpa-maven-plugin</artifactId>
                <version>2.2.0-SNAPSHOT</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.openjpa</groupId>
                        <artifactId>openjpa</artifactId>
                        <version>2.2.0-SNAPSHOT</version>
                    </dependency>
                    <dependency>
                        <groupId>com.h2database</groupId>
                        <artifactId>h2</artifactId>
                        <version>${h2.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                   
<includes>org/syncope/core/persistence/beans/**/*.class</includes>
                   
<connectionDriverName>org.springframework.jdbc.datasource.DriverManagerDataSource</connectionDriverName>
                    <connectionProperties>
                        driverClassName=org.h2.Driver,
                        url=jdbc:h2:mem:syncopedb
                        username=sa,
                        password=
                    </connectionProperties>
                </configuration>
                <executions>
                    <execution>
                        <id>enhancer</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>enhance</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

It works fine either with openjpa:enhance and openjpa:sql but it shows
some warnings:

[INFO] --- openjpa-maven-plugin:2.2.0-SNAPSHOT:enhance (enhancer) @
syncope-core ---
Downloading:
file://${basedir}/internal-repository/org/apache/openjpa/openjpa-lib/2.2.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata
org.apache.openjpa:openjpa-lib:2.2.0-SNAPSHOT/maven-metadata.xml from/to
openjpa-internal (file://${basedir}/internal-repository): Repository
path /internal-repository does not exist, and cannot be created.

Moreover, I'd like to redirect these log messages somewhere; as far as
I've understood, it should be enough to include logback in plugin's
classpath:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for
further details.

but adding it as bare <dependency> in the configuration above does not work.

Any hint?

-- 
Francesco Chicchiriccò

Apache Cocoon Committer and PMC Member
http://people.apache.org/~ilgrosso/


Re: Using 2.2.0-SNAPSHOT maven plugin

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 13/01/2012 15:47, Mark Struberg wrote:
> Hi Francesco!
>
> If you use the openjpa-maven-plugin from OpenJPA itself then you don't need to add any dependency!
>
> The new one uses openjpa-kernel, etc directly and not the 1-in-all openjpa (-all) bundle anymore.
> Please try to remove the openjpa dependency as a first step.

Removed openjpa-all dependency from plugin, but still getting

[INFO] --- openjpa-maven-plugin:2.2.0-SNAPSHOT:sql (default-cli) @
syncope-core ---
Downloading:
file://${basedir}/internal-repository/org/apache/openjpa/openjpa-lib/2.2.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata
org.apache.openjpa:openjpa-lib:2.2.0-SNAPSHOT/maven-metadata.xml from/to
openjpa-internal (file://${basedir}/internal-repository): Repository
path /internal-repository does not exist, and cannot be created.

that "file://${basedir}/internal-repository/" shouldn't be
"${settings.localRepository}" instead? (just guessing...)

> ad logging:
>
> There are 2 mechanism included
>   a.) openjpa loggin
>   b.) the plugin logging from maven
>
> If running Apache Maven with the -X option (mvn -X openjpa enhance) changes the log output, then you most probably hit b.).
>
> For running the PCEnhancer from inside the maven plugin we have the plugin classpath (thus also its <dependencies>) plus the compile classpath (this is needed for the enhancer). So any jar in your dependencies section of the openjpa-m-p should get picked up as well.

Ok, now I put some more dependencies in plugin definition:

                        <dependency>
                            <groupId>org.slf4j</groupId>
                            <artifactId>slf4j-api</artifactId>
                            <version>${slf4j.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>ch.qos.logback</groupId>
                            <artifactId>logback-core</artifactId>
                            <version>${logback.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>ch.qos.logback</groupId>
                            <artifactId>logback-classic</artifactId>
                            <version>${logback.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>org.slf4j</groupId>
                            <artifactId>jcl-over-slf4j</artifactId>
                            <version>${slf4j.version}</version>
                        </dependency>

and SLF4J warning has disappeared: now I have to convince the plugin to
pick up my logback.xml instead of printing everything to stdout :-)

> hope that gives you a bit more info to continue your research - hope that helps.

Hey, I'm almost there: I only need to "migrate" L2 cache and statistics :-)

Thanks for your support.
Regards.

> ----- Original Message -----
>> From: Francesco Chicchiriccò <il...@apache.org>
>> To: users@openjpa.apache.org
>> Cc: 
>> Sent: Friday, January 13, 2012 2:08 PM
>> Subject: Using 2.2.0-SNAPSHOT maven plugin
>>
>> Hi all,
>> I am currently using OpenJPA 2.2.0-SNAPSHOT, so plugin is configured as
>> follows:
>>
>>             <plugin>
>>                 <groupId>org.apache.openjpa</groupId>
>>                 <artifactId>openjpa-maven-plugin</artifactId>
>>                 <version>2.2.0-SNAPSHOT</version>
>>                 <dependencies>
>>                     <dependency>
>>                         <groupId>org.apache.openjpa</groupId>
>>                         <artifactId>openjpa</artifactId>
>>                         <version>2.2.0-SNAPSHOT</version>
>>                     </dependency>
>>                     <dependency>
>>                         <groupId>com.h2database</groupId>
>>                         <artifactId>h2</artifactId>
>>                         <version>${h2.version}</version>
>>                     </dependency>
>>                 </dependencies>
>>                 <configuration>
>>                   
>> <includes>org/syncope/core/persistence/beans/**/*.class</includes>
>>                   
>> <connectionDriverName>org.springframework.jdbc.datasource.DriverManagerDataSource</connectionDriverName>
>>                     <connectionProperties>
>>                         driverClassName=org.h2.Driver,
>>                         url=jdbc:h2:mem:syncopedb
>>                         username=sa,
>>                         password=
>>                     </connectionProperties>
>>                 </configuration>
>>                 <executions>
>>                     <execution>
>>                         <id>enhancer</id>
>>                         <phase>process-classes</phase>
>>                         <goals>
>>                             <goal>enhance</goal>
>>                         </goals>
>>                     </execution>
>>                 </executions>
>>             </plugin>
>>
>> It works fine either with openjpa:enhance and openjpa:sql but it shows
>> some warnings:
>>
>> [INFO] --- openjpa-maven-plugin:2.2.0-SNAPSHOT:enhance (enhancer) @
>> syncope-core ---
>> Downloading:
>> file://${basedir}/internal-repository/org/apache/openjpa/openjpa-lib/2.2.0-SNAPSHOT/maven-metadata.xml
>> [WARNING] Could not transfer metadata
>> org.apache.openjpa:openjpa-lib:2.2.0-SNAPSHOT/maven-metadata.xml from/to
>> openjpa-internal (file://${basedir}/internal-repository): Repository
>> path /internal-repository does not exist, and cannot be created.
>>
>> Moreover, I'd like to redirect these log messages somewhere; as far as
>> I've understood, it should be enough to include logback in plugin's
>> classpath:
>>
>> SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
>> SLF4J: Defaulting to no-operation (NOP) logger implementation
>> SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for
>> further details.
>>
>> but adding it as bare <dependency> in the configuration above does not 
>> work.
>>
>> Any hint?
-- 
Francesco Chicchiriccò

Apache Cocoon Committer and PMC Member
http://people.apache.org/~ilgrosso/


Re: Using 2.2.0-SNAPSHOT maven plugin

Posted by Mark Struberg <st...@yahoo.de>.
Hi Francesco!

If you use the openjpa-maven-plugin from OpenJPA itself then you don't need to add any dependency!

The new one uses openjpa-kernel, etc directly and not the 1-in-all openjpa (-all) bundle anymore.
Please try to remove the openjpa dependency as a first step.


ad logging:

There are 2 mechanism included
  a.) openjpa loggin
  b.) the plugin logging from maven

If running Apache Maven with the -X option (mvn -X openjpa enhance) changes the log output, then you most probably hit b.).


For running the PCEnhancer from inside the maven plugin we have the plugin classpath (thus also its <dependencies>) plus the compile classpath (this is needed for the enhancer). So any jar in your dependencies section of the openjpa-m-p should get picked up as well.

hope that gives you a bit more info to continue your research - hope that helps.

LieGrue,
strub



----- Original Message -----
> From: Francesco Chicchiriccò <il...@apache.org>
> To: users@openjpa.apache.org
> Cc: 
> Sent: Friday, January 13, 2012 2:08 PM
> Subject: Using 2.2.0-SNAPSHOT maven plugin
> 
> Hi all,
> I am currently using OpenJPA 2.2.0-SNAPSHOT, so plugin is configured as
> follows:
> 
>             <plugin>
>                 <groupId>org.apache.openjpa</groupId>
>                 <artifactId>openjpa-maven-plugin</artifactId>
>                 <version>2.2.0-SNAPSHOT</version>
>                 <dependencies>
>                     <dependency>
>                         <groupId>org.apache.openjpa</groupId>
>                         <artifactId>openjpa</artifactId>
>                         <version>2.2.0-SNAPSHOT</version>
>                     </dependency>
>                     <dependency>
>                         <groupId>com.h2database</groupId>
>                         <artifactId>h2</artifactId>
>                         <version>${h2.version}</version>
>                     </dependency>
>                 </dependencies>
>                 <configuration>
>                   
> <includes>org/syncope/core/persistence/beans/**/*.class</includes>
>                   
> <connectionDriverName>org.springframework.jdbc.datasource.DriverManagerDataSource</connectionDriverName>
>                     <connectionProperties>
>                         driverClassName=org.h2.Driver,
>                         url=jdbc:h2:mem:syncopedb
>                         username=sa,
>                         password=
>                     </connectionProperties>
>                 </configuration>
>                 <executions>
>                     <execution>
>                         <id>enhancer</id>
>                         <phase>process-classes</phase>
>                         <goals>
>                             <goal>enhance</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
> 
> It works fine either with openjpa:enhance and openjpa:sql but it shows
> some warnings:
> 
> [INFO] --- openjpa-maven-plugin:2.2.0-SNAPSHOT:enhance (enhancer) @
> syncope-core ---
> Downloading:
> file://${basedir}/internal-repository/org/apache/openjpa/openjpa-lib/2.2.0-SNAPSHOT/maven-metadata.xml
> [WARNING] Could not transfer metadata
> org.apache.openjpa:openjpa-lib:2.2.0-SNAPSHOT/maven-metadata.xml from/to
> openjpa-internal (file://${basedir}/internal-repository): Repository
> path /internal-repository does not exist, and cannot be created.
> 
> Moreover, I'd like to redirect these log messages somewhere; as far as
> I've understood, it should be enough to include logback in plugin's
> classpath:
> 
> SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
> SLF4J: Defaulting to no-operation (NOP) logger implementation
> SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for
> further details.
> 
> but adding it as bare <dependency> in the configuration above does not 
> work.
> 
> Any hint?
> 
> -- 
> Francesco Chicchiriccò
> 
> Apache Cocoon Committer and PMC Member
> http://people.apache.org/~ilgrosso/
>