java—使用intellij创建twitter heron项目的正确方法

rpppsulh  于 2021-06-21  发布在  Storm
关注(0)|答案(2)|浏览(331)

我正在尝试使用intellij idea启动一个heron项目(或portexistingstorm项目),但不幸的是,我不能让它工作。
我已经测试了heron文档中的所有建议说明,以从storm升级,但在更改之后 POM.xml 根据文件,我得到了一堆 cannot find symbol 在使用maven编译和添加库jar时,从基本的heron类和方法中删除jar是没有帮助的(就像使用storm时一样)。
我也试着用 setup-intellij.sh 脚本生成intellij项目,但不幸的是,它因错误而停止:

null failed: _pex failed: error executing command
bazel-out/local_linux-fastbuild/bin/3rdparty/pex/_pex --entry-point heron.shell.src.python.main bazel-out/local_linux-fastbuild/bin/heron/shell/src/python/heron-shell.pex ...
(remaining 1 argument(s) skipped)

我想知道使用intellij idea创建工作项目的最简单方法是什么。
我是否必须向intellij添加storm库和heron库?如何附加所需的库以便它可以正确编译?
如有任何建议,将不胜感激。

sqxo8psd

sqxo8psd1#

这里有一个heron项目在intellj运行。
pom.xml内容为:

<groupId>io.streaml.heron.streamlet</groupId>
    <artifactId>heron-java-streamlet-api-example</artifactId>
    <version>latest</version>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <heron.version>0.17.2</heron.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.twitter.heron</groupId>
            <artifactId>heron-api</artifactId>
            <version>${heron.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass></mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
       </plugins>
    </build>
klsxnrf1

klsxnrf12#

使用 backtype.storm.* 而不是 com.twitter.heron.api.* 导入类。这些包都存在于heron库中。只需添加以下依赖项:

<dependency>
        <groupId>com.twitter.heron</groupId>
        <artifactId>heron-storm</artifactId>
        <version>0.14.0</version>
    </dependency>

相关问题