从" sbt test"运行测试时类路径与从IDEA运行时不同

时间:2015-05-05 14:40:48

标签: scala sbt classpath scalatest

我有以下简单测试:

// define structure that is a list of Var
struct ListVar : public std::list<Var>
{
};

// struct that checks whether T is a ListVar
template<class T>
struct is_list_of_var_type : std::integral_constant<bool,std::is_same<ListVar, typename  std::remove_cv<T>::type>::value > {};

// function that only works for ListVar
template<class T
       , typename std::enable_if<is_list_of_var_type<T>::value>::type* = nullptr
       >
T foo3(T t)
{
   std::cout << " T is type ListVar " << std::endl;
   return t;
}

// ... some code ...
ListVar lv;
foo3(lv); // call foo3 for ListVar

这位于sbt项目中。从IDEA运行此测试时,此测试会成功,因为它包含class ClasspathTest extends FlatSpec with Matchers { "The classpath" should "have more than one member" in { System.getProperty("java.class.path").split(":").length should be > 1 } } 中指定的所有libraryDependencies

但是,在执行build.sbt时,它会失败,因为它只包含sbt test

现在我有一个测试依赖在这个运行时类路径上完全填充。

是否有可能以某种方式填充它?

1 个答案:

答案 0 :(得分:3)

这是Real SBT Classpath at Runtime

的副本

为了使它工作,我必须包含在我的build.sbt:

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <script type="text/javascript" src="JS/jquery-1.4.2.min.js"></script>
        <script src="JS/jquery.autocomplete.js"></script>   
        <script >

            /*Invoking the jQuery, this gets invoked in the beginning and autosuggestions are shown in the textbox , but once the controlled is transferred to servlet("Here, Connector class") and then redirected back from there to this page the autocomplete jquery doesn't work*/

            jQuery(function(){
                $("#search").autocomplete("Autofill.jsp");
            });

</head>
    <body>
        <form method="post" action="Connector" >
            <input type="text" id="search" ><input type="submit" value=" " class="tfbutton4">
        </form>
    </body>
</html>