Liquibase Error: liquibase.precondition.core.SequenceExistsPrecondition Empty result set, expected one row - liquibase

I'm getting a liquibase error with this changeset:
<changeSet id="CORE-1" author="system">
<preConditions onFail="MARK_RAN">
<not>
<sequenceExists sequenceName="HIBERNATE_SEQUENCE"/>
</not>
</preConditions>
<comment>Create HIBERNATE_SEQUENCE</comment>
<createSequence incrementBy="1"
sequenceName="HIBERNATE_SEQUENCE"/>
</changeSet>
My maven profile config:
<profiles>
<profile>
<id>buildDatabase</id>
<activation>
<property>
<name>cleandb</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<configuration>
<driver>${jdbc.driver}</driver>
<url>${jdbc.url}</url>
<username>${jdbc.username}</username>
<password>${jdbc.password}</password>
<outputDefaultSchema>true</outputDefaultSchema>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
<arguments>-Dliquibase.enableEscaping=true</arguments>
</configuration>
<executions>
<execution>
<id>generate-db-public</id>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
<configuration>
<changeLogFile>src/main/resources/db/liquibase-changelog.xml</changeLogFile>
<changeLogSchemaName>public</changeLogSchemaName>
<defaultSchemaName>public</defaultSchemaName>
<dropFirst>false</dropFirst>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml.version}</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.plugin.jdbc.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
Config & Versions:
<postgresql.plugin.jdbc.version>9.1-901.jdbc4</postgresql.plugin.jdbc.version>
<jdbc.host>localhost</jdbc.host>
<jdbc.databaseName>system_db</jdbc.databaseName>
<jdbc.url>jdbc:postgresql://${jdbc.host}/${jdbc.databaseName}</jdbc.url>
<jdbc.driver>org.postgresql.Driver</jdbc.driver>
<jdbc.username>postgres</jdbc.username>
<jdbc.password>postgres</jdbc.password>
I've tried running this with the sequence already existing and also dropping it.
But I'm getting this error message:
Error setting up or running Liquibase:
[ERROR] Migration failed for change set src/main/resources/db/1.0-changelog/1.0-changelog.xml::CORE-1::system:
[ERROR] Reason:
[ERROR] src/main/resources/db/liquibase-changelog.xml : liquibase.precondition.core.SequenceExistsPrecondition#131a7516 : Empty result set, expected one row
[ERROR] : Precondition Error: Error getting jdbc:postgresql://localhost/system_db view with liquibase.statement.core.GetViewDefinitionStatement#59838256: Expected single row from liquibase.statement.core.GetViewDefinitionStatement#1859ffda but got 0
Db Version:
PostgreSQL 11.7 (Ubuntu 11.7-2.pgdg18.04+1)

Nevermind, I just updated my postgreSQL driver dependency and it's now working:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.plugin.jdbc.version}</version>
</dependency>
And the version is:
<postgresql.plugin.jdbc.version>42.2.12</postgresql.plugin.jdbc.version>

Related

error: Task :publishMavenPublicationToNexusRepository FAILED

Here is the error i am getting while deploying artifacts to nexus repository :
Failed to retrieve remote metadata com.example:java-maven-app:1.1.0-SNAPSHOT/maven-metadata.xml: Could not transfer metadata
com.example:java-maven-app:1.1.0-SNAPSHOT/maven-metadata.xml from/to nexus-snapshots (http://64.227.148.173:8081/repository/maven
-snapshots/): authentication failed for http://64.227.148.173:8081/repository/maven-snapshots/com/example/java-maven-app/1.1.0-SN
APSHOT/maven-metadata.xml, status: 401 Unauthorized enter image description hereenter code here
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>java-maven-app</artifactId>
<version>1.1.0-SNAPSHOT</version>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.5.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- to handle any Java version mismatch, add the following configuration for maven-compiler-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://64.227.148.173:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>6.4</version>
</dependency>
</dependencies>
</project>
I had added all the required code in pom.xml file and made all changes but getting this error please help me with solving this issue.
That's a 401 error. Login credentials were not sent, or invalid login credentials were sent. You need to ensure the settings.xml file has a "server" section that matches the ID shown in that message after "from/to", which in your case is "nexus-snapshots". That should hold the login credentials needed to access Nexus Repo.
<settings>
<servers>
<server>
<id>nexus-snapshots</id>
<username>userid</username>
<password>password</password>
</server>
</servers>
...
</settings>

Maven Dependency - Failure to find eviware:maven-soapui-plugin:jar:4.5.1

I am running Soapui test using Intelliji, however I am unable to run test via Maven. Normal test works fine using SoapUITestRunner.
I am getting below error, even though I have eviware:maven-soapui-plugin:jar:4.5.1 in my project path and under .m2 repository.
Error:
Failed to execute goal on project webservice: Could not resolve dependencies for project webservice:webservice:jar:1.0-SNAPSHOT: Failure to find eviware:maven-soapui-plugin:jar:4.5.1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
Appreciate your help.
Best Regards,
Kam
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>webservice</groupId>
<artifactId>webservice</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.soapui.plugin.version>4.5.1</maven.soapui.plugin.version>
<soapui.repo.url>http://www.soapui.org/repository/maven2/</soapui.repo.url>
</properties>
<pluginRepositories>
<pluginRepository>
<id>eviwarePluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>4.5.1</version>
</dependency>
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<!-- Source directory configuration -->
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<testFailureIgnore>true</testFailureIgnore>
<!-- Setting properties for test execution -->
<properties>
<!-- Setting ReportNG listeners -->
<property>
<name>listener</name>
<value>org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter</value>
</property>
</properties>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>4.5.1</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectFile>${project.basedir}/SoapUIAutomationDemo.xml</projectFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Remove your cached jars from C:\Users\.m2\repository\com\smartbear.
enable proxy if any in your settings.xml under .m2 folder.

Unit Testing Postgres Database with Maven

First let me explain what I am doing:
Creating a Java project in Eclipse (JUNO) to unit test SQL for a Postgres database.
Using Maven2 as the build tool. I have DBUnit, and SQL maven plugins.
The goal is to drop the schema and rebuild the tables and load some data in the tables.
I've tested the SQL so I know it works. I have tested the connections so I know the URL is right.
Now onto my problem. I am new to Maven for unit testing SQL. I have tried to follow most of the online documentation. I have created my pom from the examples. While the Java code compiles, the build blows by the SQL work in the pom.xml file. Here is my pom.xml file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.premierinc.esd</groupId>
<artifactId>sqlunittest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sqlunittest</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>3.8.1</junit.version>
<maven.compiler.plugin.version>2.5.1</maven.compiler.plugin.version>
<sql.maven.plugin.version>1.5</sql.maven.plugin.version>
<postgresql.jdbc.version>9.1-901.jdbc4</postgresql.jdbc.version>
</properties>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>${sql.maven.plugin.version}</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
</dependency>
</dependencies>
<!-- common configuration shared by all executions -->
<configuration>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432:testdb</url>
<username>postgres</username>
<password>root</password>
<!-- You can comment out username/password configurations and have
maven to look them up in your settings.xml using ${settingsKey} -->
<settingsKey>sensibleKey</settingsKey>
<!--all executions are ignored if -Dmaven.test.skip=true -->
<skip>${maven.test.skip}</skip>
</configuration>
<executions>
<execution>
<id>drop-schema-before-test-if-any</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<!-- need another database to drop the targeted one -->
<url>jdbc:postgresql://localhost:5432:postgres</url>
<autocommit>true</autocommit>
<sqlCommand>DROP SCHEMA chipen CASCADE</sqlCommand>
<!-- ignore error when database is not available -->
<onError>continue</onError>
</configuration>
</execution>
<execution>
<id>create-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<autocommit>true</autocommit>
<srcFiles>
<srcFile>src/main/sql/CHI-PEN-schema.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
</dependency>
</dependencies>
<!-- common configuration shared by all executions -->
<configuration>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432:testdb</url>
<username>postgres</username>
<password>root</password>
<!-- You can comment out username/password configurations and have
maven to look them up in your settings.xml using ${settingsKey} -->
<settingsKey>sensibleKey</settingsKey>
<!--all executions are ignored if -Dmaven.test.skip=true -->
<skip>${maven.test.skip}</skip>
</configuration>
<executions>
<execution>
<phase>test-compile</phase>
<goals>
<goal>operation</goal>
</goals>
<!-- specific configurations -->
<configuration>
<type>CLEAN_INSERT</type>
<src>src/test/data/testdb_chipen_data.xml</src>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Any suggestions or hints would be greatly appreciated.
Thanks in advance.
I add the pom of your post here in corrected form. I have removed in particular the repository definition, cause they are the defaults in Maven so convention over configurations mean to define only what is really needed to define.
Furthermore i have removed the pluginManagement tags, cause this means not to really execute the things it means define things. To be more accurate pluginManagement is intended to define the versions of plugins but usually not the configuration. This is usually used in parent pom's:
<project ...>
..
<build>
<pluginManagement>
<plugins>
<plugin>
Plugin groupId, artifactId, version
</plugin>
.
</plugin>
</pluginManagement>
..
</project>
Let us get back to your pom. The follow should run:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.premierinc.esd</groupId>
<artifactId>sqlunittest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sqlunittest</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>3.8.1</junit.version>
<maven.compiler.plugin.version>2.5.1</maven.compiler.plugin.version>
<sql.maven.plugin.version>1.5</sql.maven.plugin.version>
<postgresql.jdbc.version>9.1-901.jdbc4</postgresql.jdbc.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>${sql.maven.plugin.version}</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
</dependency>
</dependencies>
<!-- common configuration shared by all executions -->
<configuration>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432:testdb</url>
<username>postgres</username>
<password>root</password>
<!-- You can comment out username/password configurations and have
maven to look them up in your settings.xml using ${settingsKey} -->
<settingsKey>sensibleKey</settingsKey>
<!--all executions are ignored if -Dmaven.test.skip=true -->
<skip>${maven.test.skip}</skip>
</configuration>
<executions>
<execution>
<id>drop-schema-before-test-if-any</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<!-- need another database to drop the targeted one -->
<url>jdbc:postgresql://localhost:5432:postgres</url>
<autocommit>true</autocommit>
<sqlCommand>DROP SCHEMA chipen CASCADE</sqlCommand>
<!-- ignore error when database is not available -->
<onError>continue</onError>
</configuration>
</execution>
<execution>
<id>create-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<autocommit>true</autocommit>
<srcFiles>
<srcFile>src/main/sql/CHI-PEN-schema.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.jdbc.version}</version>
</dependency>
</dependencies>
<!-- common configuration shared by all executions -->
<configuration>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432:testdb</url>
<username>postgres</username>
<password>root</password>
<!-- You can comment out username/password configurations and have
maven to look them up in your settings.xml using ${settingsKey} -->
<settingsKey>sensibleKey</settingsKey>
<!--all executions are ignored if -Dmaven.test.skip=true -->
<skip>${maven.test.skip}</skip>
</configuration>
<executions>
<execution>
<phase>test-compile</phase>
<goals>
<goal>operation</goal>
</goals>
<!-- specific configurations -->
<configuration>
<type>CLEAN_INSERT</type>
<src>src/test/data/testdb_chipen_data.xml</src>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Apart from the above a thing like this are integration tests and not unit tests but this is a different question/discussion.

Maven bundle packaging problem, known as MNG-4338

I'm having trouble with the maven-bundle-plugin:
I want to deploy my project as a osgi bundle, wherefore I use the packaging as bundle.
But it seems that the pom does not know a packaging as a bundle. Here you can see my pom.xml:
<project ...>...
<packaging>bundle</packaging>
<version>1.0.0</version>
<name>Simple CXF project using spring configuration</name>
<properties>
<cxf-version>2.4.2</cxf-version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>2.3.5</version>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>demo.hw.server</Export-Package>
<Bundle-Activator>demo.hw.server.Activator</Bundle-Activator>
<Require-Bundle>org.apache.cxf.bundle</Require-Bundle>
</instructions>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>1.4.0</version>
</dependency>
</dependencies>
</project>
They say, this bug has already been fixed (http://jira.codehaus.org/browse/MNG-4338), but to me it seems it hasn't. Has anyone encountered this problem before and found a solution?
The Error message is like this:
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.talend.liugang.cxf:java_first_jaxws:1.0.0 (C:\Users\Andreas\workspace\java_first_jaxws\pom.xml) has 1 error
[ERROR] Unknown packaging: bundle # line 7, column 13
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
Best regards,
saen
Given your pom example above, you should just move the maven-bundle-plugin outside of the <pluginManagement> node. <pluginManagement> is normally used for inheritance purposes in parent poms. The bundle packaging type is provided by the maven-bundle-plugin (which is why you need <extensions>true</extensions>), so this plugin is required to be outside <pluginManagement> in this case.
<project ...>...
<packaging>bundle</packaging>
<version>1.0.0</version>
<name>Simple CXF project using spring configuration</name>
<properties>
<cxf-version>2.4.2</cxf-version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>2.3.5</version>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>demo.hw.server</Export-Package>
<Bundle-Activator>demo.hw.server.Activator</Bundle-Activator>
<Require-Bundle>org.apache.cxf.bundle</Require-Bundle>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>1.4.0</version>
</dependency>
</dependencies>
</project>
Yeap, the issue is that <groupId>org.apache.felix</groupId> needs to be outside of the <pluginManagement>.
I see a similar issue. It occurs to me that it happens when the group id ends like the artifact id starts. I try to bundle something like that:
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api.plugin</artifactId>
The slf4j from the artifact id is deleted at it ends up like: org.slf4j.api.plugin in the Manifest as symbolic name.

Using jdbcdslog or log4jdbc with maven2

I'm trying to use jdbcdslog or log4jdbc with maven2. - I want to log all SQL that is executed by mvn-sql.
I installed slf4j-api (1.6.1), slf4j-log4j12 (1.6.1) and jdbcdslog (1.0.5) Jars to my local maven2-repo and configured in my pom.xml the following:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.3</version>
<dependencies>
<dependency>
<groupId>jdbcdslog</groupId>
<artifactId>jdbcdslog</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>9.0.2.0.0</version>
</dependency>
</dependencies>
<configuration>
<driver>org.jdbcdslog.DriverLoggingProxy</driver>
</configuration>
<executions>
<execution>
...
<configuration> <url>jdbc:jdbcdslog:oracle:thin:#myurl.com:1521:TEST;targetDriver=oracle.jdbc.driver.OracleDriver</url>
...
</configuration>
</execution>
</executions>
</plugin>
Executing this leads to:
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at org.jdbcdslog.DriverLoggingProxy.(DriverLoggingProxy.java:16)
Same error occurs using log4jdbc. Has anyone a glimpse about that problem?
Thanks & kind regards,
Hanno
I couldn't reproduce the problem. With the following configuration (using the "simple" binding):
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.3</version>
<dependencies>
<dependency>
<groupId>jdbcdslog</groupId>
<artifactId>jdbcdslog</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.5.3.0_1</version>
</dependency>
</dependencies>
<configuration>
<driver>org.jdbcdslog.DriverLoggingProxy</driver>
<url>jdbc:jdbcdslog:derby://localhost:1527/Q3854037-1.0-SNAPSHOT;targetDriver=org.apache.derby.jdbc.ClientDriver</url>
<username>APP</username>
<password>APP</password>
</configuration>
<executions>
<execution>
<id>drop-db-before-test-if-any</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<autocommit>true</autocommit>
<sqlCommand>select * from FOO</sqlCommand>
<!-- ignore error when database is not avaiable -->
<onError>continue</onError>
</configuration>
</execution>
</executions>
</plugin>
Running mvn test just works
$ mvn test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Q3854037
[INFO] task-segment: [test]
[INFO] ------------------------------------------------------------------------
...
[INFO] Executing commands
821 [main] INFO org.jdbcdslog.StatementLogger - java.sql.Statement.execute select * from FOO 100 ms. at org.codehaus.mojo.sql.SqlExecMojo.execSQL(SqlExecMojo.java:815)
[INFO] 1 of 1 SQL statements executed successfully
...
Sure, I'm using another SLF4J binding but I don't think this difference is relevant (even with the binding for log4j, I could not reproduce the NoClassDefFoundError). Maybe check that your SLF4J jar is not corrupted (re-download it). By the way, you're missing a dependency on log4j as logging framework.