我是Scala和SBT的新手
我正在尝试使用Scalastyle设置项目。从命令行运行时,一切正常,但我无法找到一种方法来定义Scalastyle网站上指示的选项 http://www.scalastyle.org/sbt.html
我尝试在plugins.sbt
val scalastyleConfigUrl = 一些(URL( “http://www.scalastyle.org/scalastyle_config.xml”))
我不确定如何验证这是否有效;我希望在每个编译时都能下载scalastyle_config.xml
,显然我遗漏了一些东西。
第二部分,我想自动执行scalastyle以在每个编译/构建中运行。怎么能实现呢?
谢谢
答案 0 :(得分:4)
样式表只会在默认配置中每24小时下载一次,并存储在// Pear Mail Library
require_once "Mail.php";
$from = '<your@mail.com>'; //change this to your email address
$to = '<someone@mail.com>'; // change to address
$subject = 'Insert subject here'; // subject of mail
$body = "Hello world! this is the content of the email"; //content of mail
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => $subject
);
$smtp = Mail::factory('smtp', array(
'host' => 'ssl://smtp.gmail.com',
'port' => '465',
'auth' => true,
'username' => 'your@gmail.com', //your gmail account
'password' => 'snip' // your password
));
// Send the mail
$mail = $smtp->send($to, $headers, $body);
//check mail sent or not
if (PEAR::isError($mail)) {
echo '<p>'.$mail->getMessage().'</p>';
} else {
echo '<p>Message successfully sent!</p>';
}
中。
参见文档:
scalastyleConfigUrlCacheFile
scalastyleConfigRefreshHours | Integer | If scalastyleConfigUrl is set, refresh it after this number of hours. Default value is 24.
在compile
build.sbt
简单的解决方案是通过(scalastyleConfigUrl in Compile) := Some(url("http://www.scalastyle.org/scalastyle_config.xml"))
或sbt
activator
sbt scalastyle compile
以运行compile
scalastyle
中的
build.sbt
您还可以覆盖任务定义或定义自定义任务:http://www.scala-sbt.org/0.13.0/docs/Detailed-Topics/Tasks.html#modifying-an-existing-task