小编gvl*_*sov的帖子

使用Kotlin 1.2的Maven:必需的类缺少kotlin / reflect / KDeclarationContainer

我尝试将Kotlin与Maven结合使用,所以我遵循了文档

我在pom.xml文件中有此配置

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <kotlin.version>1.2.10</kotlin.version>
</properties>

<build>
    <sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
    <testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
    <plugins>
        <plugin>
            <artifactId>kotlin-maven-plugin</artifactId>
            <groupId>org.jetbrains.kotlin</groupId>
            <version>${kotlin.version}</version>

            <executions>
                <execution>
                    <id>compile</id>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>

                <execution>
                    <id>test-compile</id>
                    <goals>
                        <goal>test-compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib-jdk8</artifactId>
        <version>${kotlin.version}</version>
    </dependency>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-reflect</artifactId>
        <version>${kotlin.version}</version>
    </dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)

源文件夹是src/main/kotlinsrc/test/kotlin

当我mvn clean install收到这个错误时

[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.2.10:compile (compile) on project kotlin-starter: Execution compile of goal org.jetbrains.kotlin:kotlin-maven-plugin:1.2.10:compile failed: A required class was missing while executing …
Run Code Online (Sandbox Code Playgroud)

java maven kotlin

5
推荐指数
1
解决办法
1118
查看次数

如何在两个不同选项卡的内容脚本之间传输数据?

在我的扩展中,我需要将一些数据从一个选项卡的内容脚本传输到另一个选项卡的内容脚本.如果我知道该标签对象的名称或网址的一部分,我如何使用chrome.tabs选择某个标签?两个标签的脚本如何通信?

更新:

显然我在chrome.extension中没有方法sendMessage.当我从内容脚本运行以下内容时:

chrome.extension.sendMessage("message");
Run Code Online (Sandbox Code Playgroud)

我进入控制台:

未捕获的TypeError:对象#没有方法'sendMessage'

google-chrome-extension content-script

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

如何使用MustacheJS忽略标记

我目前通过尝试构建小部件模块来解决MustacheJS模板的问题.

事实上,我使用了两次html模板:

  • 服务器解析html模板并使用服务器数据进行渲染
  • 客户端下载页面由服务器构建(因此已经由服务器端的胡子呈现)并且我想在ajax请求之后在浏览器中应用第二个Mustache渲染.

但问题是,由于vars在服务器端是空的,模板html不会在客户端呈现...

<!-- Rendered on server side -->
<div class="content noise">
    <h4>{{widget.title}}</h4>
    <p>Issues from {{widget.github.author}}/{{widget.github.repo}}</p>
    <div class="issues"></div>
</div>

<!-- I want to render this only on client side -->
<script type="text/template" id="issueTemplate">
{{#links}}
    <a href="{{url}}" {{#selected}}class="Selected"{{/selected}}>{{{name}}}</a>
{{/links}}
</script>
Run Code Online (Sandbox Code Playgroud)

这里的issueTemplate是空的,因为{{links}}在服务器端是空的.

在客户端,我尝试这样的事情,并将"{{"标记替换为"[[",但它没有效果:

self.mu = _.clone(Mustache) ;
self.mu.tags = ['[[', ']]'] ;
Run Code Online (Sandbox Code Playgroud)

那么你是否知道如何忽略渲染中的标签,例如'script'?

node.js mustache

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

在gvim中实际vim窗口周围的填充

在gvim中,可以出现窗口右侧和底侧的小填充.特别是当gvim窗口最大化时.例如,当我最大化gvim窗口时,这是我的gvim右下角的样子:

http://imgur.com/0lAYU

那么我可以用这些填充物做些什么吗?例如,移动实际编辑区域,使填充从gvim窗口的所有四个边均匀分布,而不是仅从两侧.本手册的任何部分是否包含对它们的描述?这里没有真正的问题,我只是好奇.

编辑:我问的是gvim的Linux版本.我不知道gvim在Windows或Mac上的类似情况下表现如何.

vim

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

在HashBiMap中改变值是否安全?

在我的代码中,我想要一个

HashBiMap<T1, HashSet<T2>> bimap;
Run Code Online (Sandbox Code Playgroud)

在bimap中改变值是否可以?当我使用时bimap.inverse(),它hashCode()是否会导致与包含可变键的HashMap相关的相同问题?

java hashcode bimap guava

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

在Squid中为SSL连接启用缓存

我们如何能够让squid缓存Web内容(让我们从firefox说)用于SSL连接,我的意思是https URL?

connection ssl https squid isenabled

4
推荐指数
2
解决办法
2万
查看次数

如果父方法抛出已检查异常,那么是否必须在子类中抛出相同的异常?

鉴于:

static class A {
    void process() throws Exception { throw new Exception(); }
}
static class B extends A {
    void process() { System.out.println("B "); }
}
public static void main(String[] args) {
    A a = new B();
    a.process();
}
Run Code Online (Sandbox Code Playgroud)

在这个问题中,当我调用 时a.process(),它会给我一个编译时错误,说“必须处理未处理的异常”。但是,如果父方法抛出任何已检查的异常,则如果我们覆盖父方法的实现,则无需在子中处理该异常。

为什么仍然检查异常?

java

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

Yii2 gridview过滤器使用自动完成文本框

在使用comboBox而不是默认(textBox)在gridview中使用以下内容进行搜索之前:

[
    'attribute' => 'project_status', 
    'filter' => $someArray,
    'value' => 'projectstatus.name',
]
Run Code Online (Sandbox Code Playgroud)

但我想从comboBox更改为自动完成textBox,因此搜索功能仍然有效.

gridview yii2

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

如何防止 Math.max() 返回 NaN?

我想创建一个从数组中返回最大数的函数,但它一直返回NaN.

如何防止 NaN 并返回想要的结果?

var thenum = [5,3,678,213];

function max(num){
    console.log(Math.max(num));
}

max(thenum);                                                                      
Run Code Online (Sandbox Code Playgroud)

javascript

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

如何防止IntelliJ IDEA重新排列javadoc标签?

/**
 * Comment.
 *
 * <p>Hello
 *
 * @author me (me@domain.com)
 * @version $Id$
 * @since 0.1
 * @checkstyle ClassDataAbstractionCoupling (500 lines)
 * @checkstyle ClassFanOutComplexity (500 lines)
 */
Run Code Online (Sandbox Code Playgroud)

当我用Ctrl+ Alt+ 重新格式化我的代码时L@since会放置在@checkstyle标记之后。有什么方法可以在重新格式化代码时禁用javadoc标签重排吗?

javadoc intellij-idea intellij-14

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