小编mku*_*urz的帖子

将依赖项存储在私有GitHub或Bitbucket存储库中

我们正在使用sbt 0.13.9,我们希望使用私有 GitHub仓库来存储公司范围的依赖项.我试着像这样向解析器添加一个私有的 GitHub repo:

resolvers += Resolver.ssh("Company Repo", "git@github.com:company/company-repo.git", "/raw/master")(Resolver.ivyStylePatterns)
// or
resolvers += Resolver.ssh("Company Repo", "git@github.com:company/company-repo.git", "/raw/master")(Resolver.ivyStylePatterns) as("githubuser")
// or
resolvers += Resolver.ssh("Company Repo", "git@github.com:company/company-repo.git", "/raw/master")(Resolver.ivyStylePatterns) as("githubuser", "password")
// or
resolvers += {
    val keyFile: File = new File(Path.userHome.absolutePath + "/.ssh/id_rsa")
    Resolver.ssh("Company Repo", "git@github.com:company/company-repo.git", "/raw/master")(Resolver.ivyStylePatterns) as("githubuser", keyFile)
}
// or
resolvers += {
    val keyFile: File = new File(Path.userHome.absolutePath + "/.ssh/id_rsa")
    Resolver.ssh("Company Repo", "git@github.com:company/company-repo.git", "/raw/master")(Resolver.ivyStylePatterns) as("githubuser", keyFile, "keyFilePassword")
}
Run Code Online (Sandbox Code Playgroud)

(对于没有提供用户和/或没有密码的解析器,弹出窗口似乎输入用户名/密码.)

但是,它总是失败:

[warn] ==== Company Maven Repo: …
Run Code Online (Sandbox Code Playgroud)

scala sbt

6
推荐指数
0
解决办法
364
查看次数

如何根据区域设置格式化YearMonth和MonthDay?

LocalDate使用特定格式在Java 8中格式化Locale可以像这样实现:

DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(myLocale).format(value);
DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM).withLocale(myLocale).format(value);
DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG).withLocale(myLocale).format(value);
DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL).withLocale(myLocale).format(value);
Run Code Online (Sandbox Code Playgroud)

假设value = LocalDate.now()这将导致:

// myLocale = Locale.ENGLISH
6/30/16
Jun 30, 2016
June 30, 2016
Thursday, June 30, 2016

// myLocale = Locale.GERMAN
30.06.16
30.06.2016
30. Juni 2016
Donnerstag, 30. Juni 2016

// myLocale = new Locale("es", "ES")
30/06/16
30-jun-2016
30 de junio de 2016
jueves 30 de junio de 2016
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,Java决定使用哪个分隔符(" - ",".","/",""等)以及如何对日期元素进行排序(例如,前一个月,反之亦然等) - 在某些语言环境中它可能是那一年第一,等等.

我的问题是:我如何格式化java.time.YearMonthjava.time.MonthDay依赖于Locale上面的例子?

基于这个例子,我希望这样的结果......

......为YearMonth:

// myLocale …
Run Code Online (Sandbox Code Playgroud)

java java-8 java-time

6
推荐指数
2
解决办法
1468
查看次数

preventDefault在不同的浏览器中表现不同

我在keydown事件上使用jQuery preventDefault:http://jsbin.com/ixaqok/edit#javascript,html 当在Firefox和Opera中运行示例代码时,按键事件仍然被触发,但在Chrome,IE8和Safari中则没有.

为什么?在所有浏览器中,preventDefault不应该工作相同吗?

谢谢!

javascript jquery

4
推荐指数
1
解决办法
180
查看次数

在 Hibernate @OrderBy 注释中的情况

是否可以CASE WHEN ... END在 Hibernate @OrderBy 注释中使用甚至本机 SQL?如何?

例如(Child对象有一个type属性):

@OneToMany
@OrderBy("CASE WHEN type='GIRL' THEN 1 WHEN type='BOY' THEN 2 ELSE 3 END ASC")
private List<Child> children;
Run Code Online (Sandbox Code Playgroud)

java hibernate jpa jpa-2.0

3
推荐指数
1
解决办法
755
查看次数

标签 统计

java ×2

hibernate ×1

java-8 ×1

java-time ×1

javascript ×1

jpa ×1

jpa-2.0 ×1

jquery ×1

sbt ×1

scala ×1