0

別のプロジェクトに依存するプロジェクトがあります。私は依存関係を更新するために sbt publish-local を使用していますが、これは悪臭を放っています。

そのため、サブプロジェクトに切り替えようとしましたが、コンパイルされませんでした。build.sbt ファイルの依存関係を Build.scala ファイルに入れてみましたが、何も変わりませんでした。

Scala 2.10.2でSBT 0.13を使用しています

元の build.sbt (競合を避けるために build._sbt に名前を変更):

name := "soot-javaee"

organization := "sable"

version := "20130902"

scalaVersion := "2.10.2"

retrieveManaged := true

libraryDependencies += "sable" %% "heros" % "20130920"

//Logging
libraryDependencies ++= Seq(
  "com.typesafe" %% "scalalogging-slf4j" % "1.0.1",
  "org.slf4j" % "slf4j-api" % "1.7.5",
  "ch.qos.logback" % "logback-core" % "1.0.13",
  "ch.qos.logback" % "logback-classic" % "1.0.13",
  "org.slf4j" % "log4j-over-slf4j" % "1.7.5",
  "org.slf4j" % "jcl-over-slf4j" % "1.7.5"
)

libraryDependencies += "org.apache.ant" % "ant" % "1.9.2"

libraryDependencies += "junit" % "junit" % "4.11"

libraryDependencies += "junit" % "junit" % "3.8.2"

javacOptions ++= Seq("-source", "1.6")

compileOrder in Compile := CompileOrder.Mixed

//change unmanaged resource folder to templates
unmanagedResourceDirectories in Compile := Seq(file("generated/sablecc/"),file("src"))

excludeFilter in (Compile, unmanagedResources) ~= (_ || "*.java" || "*.scala" || "*.html" || "*.xsl" || "*.xml")


unmanagedSourceDirectories in Compile := Seq(file("src"), file("generated/jastadd/"), file("generated/sablecc"), file("generated/options"), file("generated/singletons"))

unmanagedSourceDirectories in Test := Seq (file("tests"))

//change unmanaged library folder from lib to libs
unmanagedBase <<= baseDirectory { base => base / "libs" }

//Remove some files in the libs/ folder
//dependencyClasspath in Compile ~= { libDirs => libDirs.filter(af => af.data.getName != "scala-library.jar" && af.data.getName != "log4j-1.2.17.jar" ) }

//This disables scaladoc altogether.
sources in doc in Compile := List()

Build.scala は次のとおりです。

import sbt._
import sbt.Keys._

object DepsBuild extends Build {

  lazy val heros = /*project.in(file("../heros"))*/ RootProject(uri("git://github.com/malaverdiere/heros.git#develop"))

  lazy val root = project.in(file(".")).settings(
    name := "soot-javaee",
    organization := "sable",
    version := "20130902",
    scalaVersion := "2.10.2",
    retrieveManaged := true,
    //Logging
    libraryDependencies ++= Seq(
      "com.typesafe" %% "scalalogging-slf4j" % "1.0.1",
      "org.slf4j" % "slf4j-api" % "1.7.5",
      "ch.qos.logback" % "logback-core" % "1.0.13",
      "ch.qos.logback" % "logback-classic" % "1.0.13",
      "org.slf4j" % "log4j-over-slf4j" % "1.7.5",
      "org.slf4j" % "jcl-over-slf4j" % "1.7.5",
      "org.apache.ant" % "ant" % "1.9.2",
      "junit" % "junit" % "4.11",
      "junit" % "junit" % "3.8.2"),
    javacOptions ++= Seq("-source", "1.6"),
    compileOrder in Compile := CompileOrder.Mixed,
    //change unmanaged resource folder to templates
    unmanagedResourceDirectories in Compile := Seq(file("generated/sablecc/"), file("src")),

    excludeFilter in(Compile, unmanagedResources) ~= (_ || "*.java" || "*.scala" || "*.html" || "*.xsl" || "*.xml"),
    unmanagedSourceDirectories in Compile := Seq(file("src"), file("generated/jastadd/"), file("generated/sablecc"),
      file("generated/options"), file("generated/singletons")),
    unmanagedSourceDirectories in Test := Seq(file("tests")),
    //change unmanaged library folder from lib to libs
    unmanagedBase <<= baseDirectory {
      base => base / "libs"
    },
    //This disables scaladoc altogether.
    sources in doc in Compile := List()
  ).dependsOn(heros)

}

sbt compile を実行すると、次の出力が得られます

Loading /usr/share/sbt/bin/sbt-launch-lib.bash
[info] Loading project definition from /home/marc-andre/soot/soot/project
[info] Compiling 1 Scala source to /home/marc-andre/soot/soot/project/target/scala-2.10/sbt-0.13/classes...
[info] Set current project to soot-javaee (in build file:/home/marc-andre/soot/soot/)
[info] Compiling 9 Scala sources and 2166 Java sources to /home/marc-andre/.sbt/0.13/staging/0e4a0b0a0c1e5185ae25/heros/target/scala-2.10/classes...
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JBossWSTestDetector.scala:8: object typesafe is not a member of package com
[error] import com.typesafe.scalalogging.slf4j.Logging
[error]            ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JBossWSTestDetector.scala:26: not found: type Logging
[error] class JBossWSTestDetector extends AbstractServletDetector with Logging{
[error]                                                                ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JBossWSTestDetector.scala:34: not found: value logger
[error]     logger.trace("Non-dandling classes ({}): {}", nonDandling.size : Integer, nonDandling.map(_.name))
[error]     ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JBossWSTestDetector.scala:40: not found: value logger
[error]     jBossWsClients.foreach(logger.info("Found JBoss WS Test Client: {}", _))
[error]                            ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JBossWSTestDetector.scala:43: not found: value logger
[error]     testMethods.foreach(logger.debug("Test method found: {}", _))
[error]                         ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JBossWSTestDetector.scala:57: not found: value logger
[error]     logger.warn("Detecting Web services from configuration files is not supported yet - switching to detection from source")
[error]     ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JaxWsServiceDetector.scala:9: object typesafe is not a member of package com
[error] import com.typesafe.scalalogging.slf4j.Logging
[error]            ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JaxWsServiceDetector.scala:33: not found: type Logging
[error] object JaxWSAttributeUtils extends Logging {
[error]                                    ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JaxWsServiceDetector.scala:180: not found: value logger
[error]       logger.info("For class {}, handler file is located at: {}", sc, url)
[error]       ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JaxWsServiceDetector.scala:202: not found: value logger
[error]         logger.info("For class {}, handler file is located at: {}", sc, handlerFile)
[error]         ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JaxWsServiceDetector.scala:208: not found: value logger
[error]         logger.warn("For class {}, handler file was wrongly located at: {}", sc, handlerFile)
[error]         ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JaxWsServiceDetector.scala:255: not found: type Logging
[error] class JaxWsServiceDetector extends AbstractServletDetector with Logging{
[error]                                                                 ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JaxWsServiceDetector.scala:279: not found: value logger
[error]     logger.warn("Detecting Web services from configuration files is not supported yet - switching to detection from source")
[error]     ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JaxWsServiceDetector.scala:371: not found: value logger
[error]         logger.error("Cannot process service {} because the specified interface is not implemented or not annotated", sc.getName)
[error]         ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JaxWsServiceDetector.scala:406: not found: value logger
[error]     serviceMethods.foreach(wm => logger.trace("Web method {} hash: {}", wm, wm.hashCode() : Integer))
[error]                                  ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JaxWsServiceDetector.scala:411: not found: value logger
[error]       logger.warn("Service {} is using an handler chain. This is not supported by the analysis.", sc.name)
[error]       ^
[error] /home/marc-andre/soot/soot/src/soot/jimple/toolkits/javaee/detectors/JaxWsServiceDetector.scala:429: not found: value logger
[error]     logger.debug("Found WS. Interface: {} Implementation: {}. Wrapper: {}. Init: {} Destroy: {} Name: {} Namespace: {} " +
[error]     ^
[error] /home/marc-andre/soot/soot/src/soot/util/ScalaWrappers.scala:10: object Options is not a member of package soot.options
[error] import soot.options.Options
[error]        ^
[error] /home/marc-andre/soot/soot/src/soot/util/ScalaWrappers.scala:158: not found: value Options
[error]       if (v.getApplicationClasses.isEmpty && Options.v.process_dir().isEmpty)
[error]                                              ^
[error] 19 errors found
[error] ({git://github.com/malaverdiere/heros.git#develop}heros/compile:compile) Compilation failed
[error] Total time: 4 s, completed Oct 4, 2013 2:57:40 PM

「プロジェクト」のアウトプット

[info] In file:/home/marc-andre/soot/soot/
[info]   * root
[info] In git://github.com/malaverdiere/heros.git#develop
[info]     heros

「project {git://github.com/malaverdiere/heros.git#develop}heros」に続いて「compile」を実行しても、出力はまったく同じです。

以下の SBT コマンドの出力はすべてそのプロジェクトのものです。

「compile:unmanaged-source-directories」の出力

[info] List(src)

「ソースの検査」の出力

[info] Task: scala.collection.Seq[java.io.File]
[info] Description:
[info]  All sources, both managed and unmanaged.
[info] Provided by:
[info]  {git://github.com/malaverdiere/heros.git#develop}heros/compile:sources
[info] Defined at:
[info]  (sbt.Defaults) Defaults.scala:168
[info] Dependencies:
[info]  heros/compile:unmanagedSources
[info]  heros/compile:managedSources
[info] Delegates:
[info]  heros/compile:sources
[info]  heros/*:sources
[info]  {.}/compile:sources
[info]  {.}/*:sources
[info]  */compile:sources
[info]  */*:sources
[info] Related:
[info]  {file:/home/marc-andre/soot/soot/}root/compile:sources
[info]  {file:/home/marc-andre/soot/soot/}root/test:sources
[info]  heros/test:sources
[info]  {file:/home/marc-andre/soot/soot/}root/compile:doc::sources

それでも、「show sources」の出力 (切り捨て)

[info] ArrayBuffer(src/org/jcp/xmlns/javaee/PropertyType.java, src/org/jcp/xmlns/javaee/ServletLinkType.java, src/org/jcp/xmlns/javaee/EjbLocalRefType.java, src/org/jcp/xmlns/javaee/HandlerChainsType.java, src/org/jcp/xmlns/javaee/XsdStringType.java, src/org/jcp/xmlns/javaee/JavaTypeType.java, src/org/jcp/xmlns/javaee/package-info.java, src/org/jcp/xmlns/javaee/ParamValueType.java, src/org/jcp/xmlns/javaee/ServiceRefType.java, src/org/jcp/xmlns/javaee/EjbRefType.java, src/org/jcp/xmlns/javaee/TrueFalseType.java, src/org/jcp/xmlns/javaee/ListenerType.java, src/org/jcp/xmlns/javaee/LocalHomeType.java, src/org/jcp/xmlns/javaee/PersistenceContextTypeType.java, src/org/jcp/xmlns/javaee/HomeType.java, src/org/jcp/xmlns/javaee/RemoteType.java, src/org/jcp/xmlns/javaee/WebservicesType.java,

このコンパイル エラーを修正し、セットアップにサブプロジェクトを含めるにはどうすればよいですか?

4

1 に答える 1

1

別の絶対パスに関してすべてのパスを定義することにより、絶対パスを使用します。に相対パスを渡す場合file(...)、これは jvm 全体で共有されている現在の作業ディレクトリに相対的です。複数のプロジェクトで作業する場合、これは、サブプロジェクトのパスが、期待どおりにそのベース ディレクトリに対して相対的ではないことを意味します。

たとえば、次を使用します。

unmanagedSourceDirectories in Test := 
   Seq(baseDirectory.value / "tests")

それ以外の

unmanagedSourceDirectories in Test := 
   Seq(file("tests"))
于 2013-10-07T21:18:10.083 に答える