0

I am trying to drop tablespace in oracle via maven plugin. Here is the configuration:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>sql-maven-plugin</artifactId>
    <version>1.5</version>
    <dependencies>
        <dependency>
            <groupId>oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
    </dependencies>
    <configuration>
        <driver>oracle.jdbc.driver.OracleDriver</driver>
        <url>jdbc:oracle:thin:@localhost:1521:XE</url>
        <username>system</username>
        <password>1</password>
    </configuration>
    <executions>
        <execution>
            <id>drop</id>
            <phase>process-test-resources</phase>
            <goals>
                <goal>execute</goal>
            </goals>
            <configuration>
                <autocommit>true</autocommit>
                <sqlCommand>DROP TABLESPACE myTableSpace INCLUDING CONTENTS and DATAFILES;</sqlCommand>
                <onError>continue</onError>
            </configuration>
        </execution>
    <executions>
<plugin

This leads to the following error:

[ERROR] Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.5:execute (drop) on project database-migration: ORA-00604: error occurred at recursive SQL level 1
[ERROR] ORA-12705: Cannot access NLS data files or invalid environment specified

I have googled already and tried to set NLS_LANG both via maven plugin:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>properties-maven-plugin</artifactId>
    <version>1.0.0</version>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>set-system-properties</goal>
            </goals>
            <configuration>
                <properties>
                    <property>
                        <name>NLS_LANG</name>
                        <value>AMERICAN_AMERICA.UTF8</value>
                    </property>
                </properties>
            </configuration>
        </execution>
    </executions>
</plugin>

And command line (windows):

SET NLS_LANG=AMERICAN_AMERICA.UTF8
echo %NLS_LANG%
AMERICAN_AMERICA.UTF8    

But got same error.

Also please note that with Intellij Idea I have same connection settings and same user/pass and can drop this tablespace without any errors.

Why I can not do this via maven? How to fix this issue?

Cherry
  • 31,309
  • 66
  • 224
  • 364
  • It's going to be a configuration issue. Do your Maven and IntelliJ use the same libraries ( JDK, Oracle client, etc)? – APC Apr 08 '17 at 14:28
  • JDK is the same, for library I am not sure what Intellij uses – Cherry Apr 09 '17 at 07:01

0 Answers0