我正在嘗試使用Mavan和maven-grails-plugin構建我的grails項目。運行Maven目標時的Grails環境配置
在我的pom.xml文件中的插件配置是這樣的:
<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>
我DataSource.groovy中的配置是這樣的:
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"
}
}
的問題是,當我運行mvn clean package
嘗試使用開發環境設置而不是構建環境設置連接到數據庫。
正如您所看到的,我試圖使用元素中的標記來指定構建環境。按照這個問題 - >Maven Grails Plugin Environment
有誰知道我怎麼能得到這個使用建設環境設置,而不是發展的?
在此先感謝