我的项目有两个不同的build.gradle文件,用groovy语法编写.我想将这个groovy写入的gradle文件更改为用Kotlin语法(build.gradle.kts)编写的gradle文件.
我将向您展示根项目build.gradle文件.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
//ext.kotlin_version = '1.2-M2'
ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0-alpha01'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
我尝试了几种在互联网上找到的"方式",但没有任何效果.重命名文件,显然不是解决方案,没有帮助.我在我的根项目中创建了一个新的build.gradle.kts文件,但该文件没有显示在我的项目中.gradle也没有识别出新文件.
所以我的问题是:如何将我的groovy build.gradle文件转换为kotlin build.gradle.kts并将此新文件添加到我现有的项目中?
谢谢你的帮助.
我尝试使用 Nodemailer 发送邮件。Nodemailer本身工作正常。但我也需要模板,所以我用谷歌搜索了一下,找到了email-templates。我将它添加到项目中,安装它。一切都很好。我创建了一个模板,在开发模式下一切正常,但在生产模式下(在实时服务器上)一切正常当我尝试从我的服务器发送邮件时,Nodemailer 出现以下错误:
{ Error: No recipients defined
at SMTPConnection._formatError (node_modules/nodemailer/lib/smtp-connection/index.js:606:19)
at SMTPConnection._setEnvelope (node_modules/nodemailer/lib/smtp-connection/index.js:815:34)
at SMTPConnection.send (node_modules/nodemailer/lib/smtp-connection/index.js:431:14)
at sendMessage (node_modules/nodemailer/lib/smtp-transport/index.js:226:28)
at connection.connect (node_modules/nodemailer/lib/smtp-transport/index.js:287:21)
at SMTPConnection.once (node_modules/nodemailer/lib/smtp-connection/index.js:188:17)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:106:13)
at SMTPConnection.emit (events.js:208:7)
at SMTPConnection._actionEHLO (node_modules/nodemailer/lib/smtp-connection/index.js:1128:14)
at SMTPConnection._processResponse (node_modules/nodemailer/lib/smtp-connection/index.js:762:20)
at SMTPConnection._onData (node_modules/nodemailer/lib/smtp-connection/index.js:558:14)
at Socket._socket.on.chunk (node_modules/nodemailer/lib/smtp-connection/index.js:510:47)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12) code: 'EENVELOPE', command: 'API' }
Run Code Online (Sandbox Code Playgroud)
错误很明显。没有定义收件人,这意味着我“错过”了 Nodemailer 的“to”参数。但我没有错过。Nodemialer 无法从我的函数中给出的 Mailoptions(电子邮件)中检测到它。
好的,这是我的代码。
导入需要的模块
const nodemailer = require('nodemailer');
const …Run Code Online (Sandbox Code Playgroud)