当我运行我的测试时,我的特殊资源目录的内容special-resources被复制到该target/classes目录.我有类似的东西
unmanagedResourceDirectories in Compile += baseDirectory.value / "special-resources",
Run Code Online (Sandbox Code Playgroud)
但我不想将这些资源复制到target目录中,但我希望它们位于分叉java进程的类路径上(例如用于测试).
我试过用
unmanagedClasspath in Compile += baseDirectory.value / "special-resources",
Run Code Online (Sandbox Code Playgroud)
但资源不可用.
如何在不必复制文件的情况下将资源目录添加到类路径?或者,或者,如何设置sbt以不将资源复制到目标目录?
我有一个码头图像,其唯一的一点是启动子码头图像以进行持续集成.
如果我在任何支持docker的计算机上运行它,它将是:
docker run -d \
-e DRONE_SERVER=wss://ci.fommil.com/ws/broker \
-e DRONE_SECRET=... \
-e DOCKER_MAX_PROCS=1 \
-e DRONE_TIMEOUT=30m \
-v /var/run/docker.sock:/var/run/docker.sock \
--restart=always \
--name=drone-agent \
drone/drone:0.5 agent
Run Code Online (Sandbox Code Playgroud)
但ECS面板似乎不允许我通过v标志.我不认为这是通过,即使我选择特权模式.
该图像仅包含一个二进制文件.不可能匆匆进去.如何使用ECS工具进行调试?例如,查看docker启动参数.
我怎样才能安装插座?我是否会不得不回到管理我自己的启动docker的EC2实例?
如下所述:
从@ManyToMany映射中删除条目时,需要手动调整元素以删除外键。
我多年来一直在使用我自己的 JPA CRUD 并且有一个很好的解决方案:CrudDao例如NoteDao。
但是最近Spring JPA以及通过声明一个接口然后namedQuery在@Entity.
但是如何解决@ManyToMany删除问题?我基本上会remove在我的 Crud上有一些方法来公开 JPA 的这个“特性”。
我想在开源之前为我的项目创建一个sbt插件.
该项目将Java代理程序附加到运行应用程序的开始,以便对其进行各种类型的分析.代理写出文本文件以供以后处理.
我希望能够编写一个可以的sbt插件
run被调用的替代方法,runWithProfiling它会启动一个新的java进程,并将代理添加到参数列表中,并传递所有用户命令.我大致知道如何创建新命令,但我不知道如何最好地实现替代run...我不想通过复制所有代码来重新发明轮子run.有没有一种方法可以调用,run但确保我的参数传递(一次),它肯定是一个新的java进程?
此外,能够为测试做同样的事情会很棒.
更新:这是我目前拥有的代码,但它遇到了几个问题,标记为TODOs
import sbt._
import Keys._
import sbt.Attributed.data
object LionPlugin extends Plugin {
val lion = TaskKey[Unit]("lion", "Run a main class with lions-share profiling.")
override val projectSettings = Seq(
fork := true,
javaOptions ++= Seq(
"-Xloggc:gc.log", "-XX:+PrintGCDetails", "-XX:+PrintGCDateStamps",
"-XX:+PrintTenuringDistribution", "-XX:+PrintHeapAtGC"
// TODO: need to get hold of the local jar file for a particular artifact
// IMPL: pass the jar as …Run Code Online (Sandbox Code Playgroud) 我在测试中有这种方便的方法:
def assertFormat[T: SexpFormat](start: T, expect: Sexp): Unit = {
val sexp = start.toSexp
assert(sexp === expect, s"${sexp.compactPrint} was not ${expect.compactPrint}")
expect.convertTo[T] should be(start)
}
Run Code Online (Sandbox Code Playgroud)
这基本上是一个运行断言模式的便利,我做了很多.
Matcher由于隐含的要求,SexpFormat[T]我不可能将其重写为(虽然我有兴趣听到不需要我写入类型MyFormat的方法foo should roundTrip[MyFormat](...))
如果在此实用程序方法中任何测试失败,则scalatest会将内部标记assertFormat为导致测试失败的原因.但我真的希望scalatest能够检测到这种方法的调用者是测试的原因.我怎样才能做到这一点?
即电流输出是
[info] - should support custom missing value rules *** FAILED ***
[info] SexpNil did not equal SexpCons(SexpSymbol(:duck),SexpCons(SexpNil,SexpNil)) nil was not (:duck nil) (FormatSpec.scala:11)
[info] org.scalatest.exceptions.TestFailedException:
[info] at org.scalatest.Assertions$class.newAssertionFailedException(Assertions.scala:529)
[info] at org.scalatest.FlatSpec.newAssertionFailedException(FlatSpec.scala:1691)
[info] at org.scalatest.Assertions$AssertionsHelper.macroAssert(Assertions.scala:502)
[info] at org.ensime.sexp.formats.FormatSpec$class.assertFormat(FormatSpec.scala:11)
[info] …Run Code Online (Sandbox Code Playgroud) 我有一个org.w3c.dom.Element我正在从我XmlAdapter的自定义返回@XmlElement,我想将它作为任意XML包含在JAXB对象中(我知道我必须手工制作XSD).然而,JAXB抱怨道
org.w3c.dom.Element is an interface, and JAXB can't handle interfaces.
Run Code Online (Sandbox Code Playgroud)
显然,w3c XML类型不支持Java类型,这是一种耻辱.但除此之外,当我使用javax.xml.transform.Result显然支持时,我得到相同的错误.
如何在JAXB中包含任意XML元素作为元素?
注意:根据https://forums.oracle.com/thread/1668210我也试过了
MessageFactory factory = MessageFactory.newInstance();
message = factory.createMessage();
SOAPElement element = message.getSOAPBody().addDocument(doc);
Run Code Online (Sandbox Code Playgroud)
但这也给出了同样的错误.
我能够将我的多项目的 jar 之一构建为单个 jar,然后发布它如何使用 sbt 和 sbt-release 发布一个 fat JAR(带有依赖项的 JAR)?
但是,相关联的内容pom.xml并未随之发布。
如何创建和发布jarpom.xml的(和 ivy 文件)描述符sbt-assembly?
我的项目是lion-share。
人们可以写出类似的东西
(managedClasspath in Compile).value
Run Code Online (Sandbox Code Playgroud)
获得的值managedClasspath中的Compile配置.
类型(managedClasspath in Compile)再次是sbt.TaskKey(因为我们in用a 调用方法ConfigKey).
然而value,SettingKey或者没有方法TaskKey,我找不到任何提供这种方法的隐式类.那怎么会存在呢?这是一个神奇的宏伏都教吗?
我经常发现在为每个实现做同样的事情之前我需要提取密封特征的类型:
sealed trait Trait
case class Foo() extends Trait
case class Bar() extends Trait
// ... lots of other implementations
// *must* take a `Trait`, not a `T <: Trait`
def thing(t: Trait): ??? = t match {
case f: Foo => // something with the instance and specific type
case b: Bar => // something with the instance and specific type
// ... same thing again for other implementations
}
Run Code Online (Sandbox Code Playgroud)
例如
// typically provided by somebody else...
trait Thing[T] …Run Code Online (Sandbox Code Playgroud) 直到最近,我才能够使用这个 recipe从 docker 容器中的源代码构建 emacs 。然而,截至上周,我所有的构建都失败了
Warning: Your system has a gap between BSS and the
heap (32188607 bytes). This usually means that exec-shield
or something similar is in effect. The dump may
fail because of this. See the section about
exec-shield in etc/PROBLEMS for more information.
Run Code Online (Sandbox Code Playgroud)
我已经阅读了etc/PROBLEMS并且它对我没有任何意义。有谁知道如何为 docker 容器解释这个,以及我可以做些什么来重新构建 emacs hub.docker.com?
我试过了
cat 0 > /proc/sys/kernel/exec-shield
Run Code Online (Sandbox Code Playgroud)
但我不认为这真的是问题所在,它不存在于容器中。