grails项目使用qrcode插件:
(1)在BuildConfig.groovy中引入安装插件:
plugins {
runtime ":hibernate:$grailsVersion"
runtime ":jquery:1.8.3"
runtime ":resources:1.1.6"
// Uncomment these (or add new ones) to enable additional resources capabilities
//runtime ":zipped-resources:1.0"
//runtime ":cached-resources:1.0"
//runtime ":yui-minify-resources:0.1.4"
build ":tomcat:$grailsVersion"
runtime ":database-migration:1.2.1"
compile "org.grails.plugins:qrcode:0.7"
}
若提示安装插件不成功,就为其指定下载来源:
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
grailsCentral()
mavenLocal()
mavenCentral()
mavenRepo "http://repo.grails.org/grails/plugins/"
}
(2)插件安装成功后,在gsp页面直接引用就可以了:
<qrcode:image text="${wxurl}"/>