好的,按照使用Java 8的先决条件和说明,项目创建工作。
sbt new akka/akka-grpc-quickstart-java.g8
然后继续使用指南
./gradlew compileJava也能工作。
但是,./gradlew --info runServer失败了,出现了折叠错误/问题:
Task ':runServer' is not up-to-date because:
Task has not declared any outputs.和
Error: Main method not found in class com.example.helloworld.GreeterServer, please define the main method as:
public static void main(String[] args)原始帖子:
我在运行Akka-GRPC示例时遇到了困难。我试着跟踪这里的导游,但是当我下载示例项目时,它似乎不完整。
这就是树命令的输出:
.
├── build.sbt
├── project
│ ├── build.properties
│ └── plugins.sbt
├── sbt
├── sbt.bat
└── sbt-dist
├── bin
│ ├── sbt
│ ├── sbt.bat
│ ├── sbt-launch.jar
│ └── sbt-launch-lib.bash
└── conf
├── sbtconfig.txt
└── sbtopts
4 directories, 11 files在项目结构中没有源文件或梯度pom.xml。
接下来,我克隆了来自GitHub的示例存储库并遵循了自述文件中的指令,主要是命令sbt new akka/akka-grpc-quickstart-java.g8。
$ sbt new akka/akka-grpc-quickstart-java.g8
[info] Loading settings for project akka-grpc-quickstart-java-g8-build from paradox.sbt,giter8.sbt ...
[info] Loading project definition from /home/johannes/IdeaProjects/akka-grpc-quickstart-java.g8/project
error: error while loading String, class file '/modules/java.base/java/lang/String.class' is broken
(class java.lang.NullPointerException/null)
[error] java.io.IOError: java.lang.RuntimeException: /packages cannot be represented as URI
...//had to remove stacktrace was too long for this post
[error] at xsbt.boot.Boot.main(Boot.scala)
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? [error] java.io.IOError: java.lang.RuntimeException: /packages cannot be represented as URI
[error] Use 'last' for the full log.然后,我进入了项目/源文件夹。/src/main/g8/源文件所在的位置,并尝试按照指南中的说明进行操作。由于某些属性错误,这也无法工作:
在此之前,我必须在./ gradle /wrapper/gradle-wrapper.properties中设置另一个gradle版本(6.1.1,是4.5.1),以使其与Java 13兼容。
$ ./gradlew compileJava
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'g8'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find gradle.plugin.com.lightbend.akka.grpc:akka-grpc-gradle-plugin:$akka_grpc_version$.
Searched in the following locations:
- file:/home/johannes/.m2/repository/gradle/plugin/com/lightbend/akka/grpc/akka-grpc-gradle-plugin/$akka_grpc_version$/akka-grpc-gradle-plugin-$akka_grpc_version$.pom
- https://plugins.gradle.org/m2/gradle/plugin/com/lightbend/akka/grpc/akka-grpc-gradle-plugin/$akka_grpc_version$/akka-grpc-gradle-plugin-$akka_grpc_version$.pom
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s我试图至少暂时地将这些属性硬编码到build.gradle文件中:
//classpath 'gradle.plugin.com.lightbend.akka.grpc:akka-grpc-gradle-plugin:$akka_grpc_version$'
classpath 'gradle.plugin.com.lightbend.akka.grpc:akka-grpc-gradle-plugin:0.7.3'但这也只让我了解到:
$ ./gradlew compileJava
FAILURE: Build failed with an exception.
* Where:
Build file '/home/johannes/IdeaProjects/akka-grpc-quickstart-java.g8/src/main/g8/build.gradle' line: 20
* What went wrong:
A problem occurred evaluating root project 'g8'.
> Failed to apply plugin [id 'com.google.protobuf']
> Could not create an instance of type com.google.protobuf.gradle.ProtobufSourceDirectorySet.
> 'void org.gradle.api.internal.file.DefaultSourceDirectorySet.<init>(java.lang.String, java.lang.String, org.gradle.api.internal.file.FileResolver, org.gradle.api.internal.file.collections.DirectoryFileTreeFactory)'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s由于字符限制,再次不能包括整个堆栈跟踪。
我遗漏了什么?我应该进一步采取哪一种方法?
发布于 2020-02-17 17:22:49
编辑:同时,拉请求被接受,主回购(https://github.com/akka/akka-grpc-quickstart-java.g8)是最新的.
我使用sbt .下载了这个项目,但是pom.xml中有一个错误(固定版本:https://github.com/olitazl/akka-grpc-quickstart-java.g8)
示例项目的问题是在public类中缺少GreeterServer修饰符。
因此,您必须将public添加到GreeterServer类和方法main中。
public class GreeterServer ...
public static void main(...)如果您重新创建您的项目从我的回购,问题也是修复那里。
https://stackoverflow.com/questions/60168791
复制相似问题