grails 3:“由于缺少gradle.properties,无法确定grails包装器版本". [英] grails 3: "could not determine grails wrapper version due to missing gradle.properties"

查看:40
本文介绍了grails 3:“由于缺少gradle.properties,无法确定grails包装器版本".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试建立一个新项目并在grails 3中运行.

We are trying to get a new project up and running in grails 3.

我们由此创建了一个项目:

We created a project thusly:

grails create-app plugin-domain --profile=plugin

现在按照文档此处,在4.1节中创建域类说,它做到了:

Now following the documentation here, in section 4.1 creating a domain class it says to do this:

./grailsw create-domain-class Vehicle

当我们使用域类进行此操作时,我们得到:

When we do this with our domain class, we get:

"could not determine grails wrapper version due to missing gradle.properties"

我们不知道grailsw是什么(我们习惯在2.5中使用"grails"),也不知道gradle.properties应该包含什么,也不知道为什么grails.properties不是由grails自动构建的.

We dont know what grailsw is (we are used to using "grails" with 2.5), and we don't know what gradle.properties should contain, nor why it was not built by grails automatically.

很明显,这是一个插件(仅设计用于容纳域对象和服务),而不是应用程序,因此我们不能直接使用run-app运行它.

Obviously this is a plugin (designed to hold the domain objects and services only), not an app, so we cant run it with run-app directly.

有趣的是,我们只是尝试使用"grails create-domain-class xxx"的旧方法,并且它起作用了,所以问题是为什么推荐的grailsw命令为什么不起作用,我们如何解决呢?

Interestingly, we just tried the old way, using "grails create-domain-class xxx" and it worked, so the question is why doesnt the recommended grailsw command work, and how do we fix it?

进行一些调查,grailsw是某种包装,不需要安装grails.任何运行诸如create-domain-class之类的东西的人都将安装grails,所以我们不太明白它的意义吗?这将导致grails至少两次安装,一次是正确的安装方式,第二次是由包装系统安装.包装器的用例是什么?在生产中,您将对tomcat或类似产品投降,在开发人员中,无论如何,所有开发人员都将安装grails.我们可以忽略grailsw还是需要对其进行修复?

Doing some investigation, grailsw is some sort of wrapper to not require grails to be installed. Anyone running things like create-domain-class will have grails installed, so we don't quite see the point of it? It will result in grails being installed at least twice, once the proper way, and a second time by the wrapper system. What is the use case for the wrapper? In production you would drop a war on tomcat or similar, in dev all devs will have grails installed anyway. Can we ignore grailsw, or do we need to fix it?

推荐答案

为什么推荐的grailsw命令不起作用,以及我们如何解决该问题

why doesnt the recommended grailsw command work, and how do we fix it

它不起作用,因为缺少 gradle.properties 文件.为什么会丢失它,我不知道,因为它是在运行命令时为我创建的.

It doesn't work because the gradle.properties file is missing. Why it is missing, I can't know because it gets created for me when I run the command.

Jamess-MacBook-Pro:demo jameskleeh$ grails create-app foo -profile plugin
| Application created at /Users/jameskleeh/demo/foo
Jamess-MacBook-Pro:demo jameskleeh$ cd foo
Jamess-MacBook-Pro:foo jameskleeh$ cat gradle.properties
grailsVersion=3.2.9
gormVersion=6.0.10.RELEASE
gradleWrapperVersion=3.4.1

任何运行诸如create-domain-class之类的东西的人都会有grails已安装,所以我们不太明白它的意义吗?

Anyone running things like create-domain-class will have grails installed, so we don't quite see the point of it?

也许您可以与您的团队进行这种假设,但这并不适用于所有人.

Perhaps you can make that assumption with your team, however that doesn't apply to everyone.

一旦安装了grails,它将至少安装两次.正确的方法,然后由包装系统再次进行.

It will result in grails being installed at least twice, once the proper way, and a second time by the wrapper system.

那是不正确的.包装器不会像通过sdkman或直接下载它那样安装" Grails.如果尚不存在,它将把Grails下载到您的Maven缓存中.无论您是否使用包装器,第一次解析该版本的依赖项时,Grails都会在您的Maven缓存中,因此它不会为您的系统添加任何尚不存在的内容.

That is incorrect. Grails will not be "installed" by the wrapper in the same way you would via sdkman or simply downloading it. It will download Grails to your maven cache if it doesn't already exist. Grails will be in your maven cache the first time you resolve the dependencies for that version whether or not you use the wrapper, so it adds nothing to your system that wouldn't already be there.

包装器的用例是什么?

What is the use case for the wrapper?

包装器的用例是,使开发人员不必管理现有项目的Grails版本.在可能具有不同版本的多个项目中工作时,无需在已安装版本之间切换.如果您始终使用包装器,则将始终使用正确的Grails版本.此外,可能根本没有安装Grails的开发人员不需要安装Grails即可开始在项目上工作.

The use case for the wrapper is so that developers don't have to manage Grails versions for existing projects. You don't have to switch between installed versions when working on multiple projects that may have different versions. If you always use the wrapper, you will always be using the correct Grails version. In addition, developers that may not have Grails installed at all don't need to install Grails in order to start working on a project.

也不必在系统上安装Grails即可创建项目.通过 start.grails.org 网站,您只需单击一下按钮或简单地下载新创建的项目.curl命令.然后,您可以将Grails包装器用于这些项目,而不必完全安装Grails.

It is also not necessary to have Grails installed on your system to create projects. With the start.grails.org site you can download freshly created projects with either a click of a button or a simple curl command. You can then use the Grails wrapper with those projects and never have to have Grails installed at all.

这篇关于grails 3:“由于缺少gradle.properties,无法确定grails包装器版本".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆