Hi,

This is my production profile resides in my root pom.xml file:

<!-- ================= Production Settings Profile
========================== -->
    <!-- Use "-P prod" when you want to run production mode                     
 
-->
    <!-- This profile skips hibernate3, dbunit repopulation and the test
plugins. -->
    <!--
======================================================================== -->
    <profiles>
        <profile>
            <id>prodx</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>           
            <build>
                               
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>dbunit-maven-plugin</artifactId>
                        <version>1.0-beta-1</version>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>hibernate3-maven-plugin</artifactId>
                        <version>2.0-alpha-2</version>
                        <configuration>
                        <components>
                            <component>
                                <name>hbm2doc</name>
                               
<implementation>annotationconfiguration</implementation>
                            </component>
                            <component>
                                <name>hbm2ddl</name>
                               
<implementation>annotationconfiguration</implementation>
                            </component>
                        </components>
                        <componentProperties>
                            <drop>false</drop>
                            <export>true</export>
                            <outputfilename>schema.sql</outputfilename>
                           
<propertyfile>web/target/classes/jdbc.properties</propertyfile>
                            <skip>true</skip>
                        </componentProperties>          
                        </configuration>                        
                    </plugin>
                </plugins>                                
            </build>
            <properties>
               
<dbunit.dataTypeFactoryName>org.dbunit.dataset.datatype.DefaultDataTypeFactory</dbunit.dataTypeFactoryName>
                <dbunit.operation.type>CLEAN_INSERT</dbunit.operation.type>
               
<hibernate.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</hibernate.dialect>
                <jdbc.groupId>mysql</jdbc.groupId>
                <jdbc.artifactId>mysql-connector-java</jdbc.artifactId>
                <jdbc.version>5.0.5</jdbc.version>
               
<jdbc.driverClassName>com.mysql.jdbc.Driver</jdbc.driverClassName>
               
<jdbc.url><![CDATA[jdbc:mysql://localhost/mydatabase?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8]]></jdbc.url>
                <jdbc.username>user</jdbc.username>
                <jdbc.password>pass</jdbc.password>
            </properties>
        </profile>
    </profiles>



When I from root execute: mvn clean install -P prodx

I get below errors (seems like it can't find jdbc driver because
ClassNotFoundException maybe due to I run from root pom ?)

Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

Full exception:

------------------

[INFO] Preparing hibernate3:hbm2ddl
[WARNING] Removing: hbm2ddl from forked lifecycle, to prevent recursive
invocation.
[INFO] [aspectj:compile {execution: default}]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [hibernate3:hbm2ddl {execution: default}]
[INFO] src/main/resources/hibernate.cfg.xml not found within the project.
Trying absolute path.
[INFO] No hibernate configuration file loaded.
[INFO] Configuration Properties file loaded:
E:\Development\giftmanager\core\target\test-classes\jdbc.properties
ERROR - SchemaExport.execute(202) | schema export unsuccessful
java.sql.SQLException: No suitable driver found for
jdbc:mysql://localhost/mydatabase?createDatabaseIfNotExist=true&useUn
        at java.sql.DriverManager.getConnection(DriverManager.java:602)
        at java.sql.DriverManager.getConnection(DriverManager.java:154)
        at
org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
        at
org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:28)
        at
org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:180)
        at
org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
        at
org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute(Hbm2DDLExporterMojo.java:112)
        at
org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:140)
        at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[WARNING] 1 errors occurred while performing <hbm2ddl>.
[ERROR] Error #1: java.sql.SQLException: No suitable driver found for
jdbc:mysql://localhost/mydatabase?createDatabaseIfNotEx
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [dbunit:operation {execution: default}]
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Error executing database operation: CLEAN_INSERT

Embedded error: com.mysql.jdbc.Driver
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error executing
database operation: CLEAN_INSERT
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error executing
database operation: CLEAN_INSERT
        at
org.codehaus.mojo.dbunit.OperationMojo.execute(OperationMojo.java:110)
        at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
        ... 16 more
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at
org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
        at
org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
        at
org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
        at
org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at
org.codehaus.mojo.dbunit.AbstractDbUnitMojo.createConnection(AbstractDbUnitMojo.java:159)
        at
org.codehaus.mojo.dbunit.OperationMojo.execute(OperationMojo.java:93)
        ... 18 more
[INFO]
------------------------------------------------------------------------

------------------









mraible wrote:
> 
> What do you have so far and what's not working (i.e. what errors are you
> seeing)?
> 
> On Fri, Sep 18, 2009 at 5:31 AM, taltun <tunca...@gmail.com> wrote:
> 
>>
>> Hi guys,
>>
>> I hope some of you can help me, I have spent 1½ day on this and still no
>> solution. I know there are some thread relating to this issue on this
>> forum
>> but none help :(
>>
>> I make use of AppFuse struts2 modular 2.02.
>>
>> What I want how to customize the current poms to do following is
>> following:
>>
>> 1. Add a profile for production
>>    * Should point to a different mySQL production database than the
>> current
>> configured to test.
>>    * Should NOT be activated default
>>    * Should NOT drop the database
>>    * Should NOT re-populate the database with sample-data.xml
>>    * Should create an output fil with schema/ddl
>>    * Should be executed from root pom.xml, /web/pom.xml and /core/pom.xml
>>    * IN WHAT pom.xml (root, web or core or all of them) file should I
>> place
>> this profile ???
>>
>> 2. Add a profile for test
>>    * Actually should be work like it does today but included in a test
>> profile
>>    * Should be activated default
>>    * Should point to a specific mySQL test database than produktion
>> database
>>    * Should create database if not exist, ddl and repopulate
>> sample-data.xml
>>    * Should be executed from root pom.xml, /web/pom.xml and /core/pom.xml
>>
>>
>> Please, show two examples of above profiles and what module should I
>> place
>> the profiles (root, /web, /core module) ?
>>
>> -taltun
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Production-and-Test-Profiles-tp25505742s2369p25505742.html
>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
>> For additional commands, e-mail: users-h...@appfuse.dev.java.net
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Production-and-Test-Profiles-tp25505742s2369p25509777.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to