Sunday, 18 March 2012

Liquibase Maven Plugin - Issue with non local database

There is an option in Liquibase to prompt for permission if the database it connects to is not in local system.
By default this option is turned off as per the Liquibase documentation, but when execute through maven Liquibase plugin seems like this default is other way round and by default it is true and even if add the property

promptOnNonLocalDatabase=false


to liquibase properties file, it is not changing its behavior, when we execute this in non head environments like unix, it does through following exception


No X11 DISPLAY variable WAS set, this program aims Performed year operation Which
Requires it.
at java.awt.GraphicsEnvironment.checkHeadless (GraphicsEnvironment.java: 159)
at java.awt.Window.(Window.java: 407)
at java.awt.Frame.(Frame.java: 402)
at java.awt.Frame.(Frame.java: 367)
at $ javax.swing.SwingUtilities SharedOwnerFrame.(SwingUtilities.java: 1731)
at javax.swing.SwingUtilities.getSharedOwnerFrame (SwingUtilities.java: 1808)
at javax.swing.JOptionPane.getRootFrame (JOptionPane.java: 1673)
at javax.swing.JOptionPane.showOptionDialog (JOptionPane.java: 846)
at javax.swing.JOptionPane.showConfirmDialog (JOptionPane.java: 779)
at javax.swing.JOptionPane.showConfirmDialog (JOptionPane.java: 741)
at liquibase.SwingUIFacade.promptForNonLocalDatabase (SwingUIFacade.java: 15)



Solution to this problem is ,


Just add the following in to the maven plugin configuration section

  <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>

Example :


<build>
      <plugins>
        <plugin>
          <groupId>org.liquibase</groupId>
          <artifactId>liquibase-maven-plugin</artifactId>
          <version>2.0.1</version>
          <executions>
            <execution>
              <phase>process-resources</phase>
              <configuration>
                <propertyFile>target/classes/liquibase.properties</propertyFile>
                <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
              </configuration>
              <goals>
                <goal>update</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>

Hope this helps....

7 comments:

  1. I can't even tell you how helpful this WAS. Thanks!

    ReplyDelete
  2. I second and third the motion - thanks!

    ReplyDelete
  3. Thanks a lot, very helpful!

    ReplyDelete
  4. You are awesome. Thank you so much

    ReplyDelete