I am trying to build my grails project with Mavan and the maven-grails-plugin.
The plugin config in my pom.xml file looks like this:
<plugin>
<groupId>org.grails</groupId>
<artifactId>grails-maven-plugin</artifactId>
<version>${grails.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>init</goal>
<goal>maven-clean</goal>
<goal>validate</goal>
<goal>config-directories</goal>
<goal>maven-compile</goal>
<goal>maven-test</goal>
<goal>maven-war</goal>
<goal>maven-functional-test</goal>
</goals>
<configuration>
<env>build</env>
</configuration>
</execution>
</executions>
</plugin>
My DataSource.groovy config looks like this:
environments {
development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:mysql://localhost/mydb?useUnicode=yes"
username = "dev"
password = "dev"
}
hibernate {
show_sql = true
}
}
build {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:mysql://localhost/mydb?useUnicode=yes"
username = "remote"
password = "remote"
}
}
The problem is that when I run mvn clean package
it tries to connect to the database using the development environment settings rather than the build environment settings.
As you can see Ive tried to specify the build environment using the tag in the element. As per this question-> Maven Grails Plugin Environment
Does anyone know how I can get this to use the build environment settings instead of the development ones?
Thanks in advance