在 gradle 中使用分发插件创建存档时有什么方法可以配置分发文件名吗?
这是我的build.gradle(我正在使用gradle 2.10)文件:
apply plugin: 'distribution'
version '1.2'
distributions {
custom {
baseName = 'someName'
contents {...}
}
}
Run Code Online (Sandbox Code Playgroud)
并调用任务customDistZip创建文件:$buildDir/distributions/someName-1.2.zip我希望将文件名配置为:(someName.zip没有版本号)。
我的解决方法是创建新任务以在创建后重命名 zip 文件并使用 gradlefinalizedBy功能:
task renameDist {
doLast {
new File("$buildDir/distributions/someName-${project.version}.zip")
.renameTo("$buildDir/distributions/someName.zip")
}
}
customDistZip.finalizedBy renameDist
Run Code Online (Sandbox Code Playgroud)
但这看起来不像是优雅和好的解决方案。
我使用控制台在Grails 3.0.3中创建了新的应用程序:
grails create-app hello
Run Code Online (Sandbox Code Playgroud)
它运行良好:
grails run-app
Run Code Online (Sandbox Code Playgroud)
但是现在,我想将Application.groovy所在的软件包名称(原始位置为hello/grails-app/init/hello/Application.groovy)更改为其他名称,例如hello/grails-app/init/foo/Application.groovy.当我在更改后尝试启动应用程序时,存在异常:
Error: Could not find or load main class hello.Application
Run Code Online (Sandbox Code Playgroud)
Application.groovy文件的来源(由grails生成,包名除外)
package foo
import grails.boot.GrailsApp
import grails.boot.config.GrailsAutoConfiguration
class Application extends GrailsAutoConfiguration {
static void main(String[] args) {
GrailsApp.run(Application, args)
}
}
Run Code Online (Sandbox Code Playgroud)
任何提示,我应该在哪里更改一些东西,以便能够重命名这个包?
编辑:在文档中有一个片段:
grails-app/init/PACKAGE_PATH/Application.groovy The Application class used By Spring Boot to start the application
Run Code Online (Sandbox Code Playgroud)
但仍然不知道什么是PACKAGE_PATH以及如何设置它.
我正在使用validation-api来验证输入字段是否包含非法字符:<>'"等我正在使用@Pattern注释,并将自定义消息转换为以下内容:以下符号<>"'"是不允许.打印此消息时,缺少单引号char.我有:以下标志<>""是不允许的.
我已经尝试在message.properties中使用\'和\ u0027和'但没有成功(在消息中有第三种情况是片段').消息显示使用:
<p class="error" th:if="${#fields.hasErrors('company.name')}" th:errors="${company.name}">error</p>
Run Code Online (Sandbox Code Playgroud)
Thymeleaf版本:2.1.3.RELEASE
春季版:3.2.8.RELEASE
Spring webflow版本:2.4.0.RELEASE
我最近安装了grails 3.1.x并使用mysql进行了测试.行.当我移动类似于MS Express 2008时,我发现:没有为jdbc:sqlserver找到合适的驱动程序. 我无法找到与maven正确的MS依赖关系所以我从Microsoft服务器下载了基本的jdbc4.jar,但GRAILS不知道我有它; 所以
谢谢你的任何提示.