因手贱乱删文件导致的编译错误 opentcs-integration-example

最近在看opentcs的源代码,
终于对于opentcs的源代码读熟悉了,也没有问题了。
想着有现成的例子opentcs-integration-example用于对接实物车辆,(以前下载过、编译过成功运行过),于是又将这个“很有保障、稳定”的代码翻出来继续看,结果发现有一些变量无法在netbeans上跳转,各种折腾,结果发现编译总是失败,因为正在看代码,于是也没有太在意,一边随意查找着原因一边继续看代码。
结果到了后面,我需要对代码编译并进行实验的时候,出了问题, 出现过如下几种报错:

Script '/home/mima123/opentcs-integration-example-master/gradle/publishing-java.gradle' line: 12
* What went wrong:
A problem occurred evaluating script.
> Could not get unknown property 'java' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9.3/userguide/command_line_interface.html#sec:command_line_warnings
* What went wrong:
A problem occurred evaluating script.
> Could not set unknown property 'classifier' for task ':openTCS-Example-CommAdapter-Vehicle:sourcesJar' of type org.gradle.api.tasks.bundling.Jar.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
FAILURE: Build failed with an exception.
* Where:
Script '/home/mima123/opentcs-integration-example-master/gradle/publishing-common.gradle' line: 1
* What went wrong:
A problem occurred evaluating script.
> Failed to apply plugin class 'org.gradle.api.publish.plugins.PublishingPlugin'.
   > Cannot run Project.afterEvaluate(Action) when the project is already evaluated.
Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from '/home/mima123/opentcs-integration-example-master/gradle/wrapper/gradle-wrapper.properties'.
	at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
	at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
	at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.lang.RuntimeException: No value with key 'distributionUrl' specified in wrapper properties file '/home/mima123/opentcs-integration-example-master/gradle/wrapper/gradle-wrapper.properties'.
	at org.gradle.wrapper.WrapperExecutor.reportMissingProperty(WrapperExecutor.java:135)
	at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:78)
	at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
	at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
	... 2 more

上面最后一个错误信息,是因为源代码需要用java13,但实际我用了java17导致的

网上查不到原因,用废话文学生成器也不行,我也是醉了,搞了整整4天,终于发现问题在于我删掉了openTCS-Contrib-Communication-TCP文件夹中的build.gradle,然后把压缩包里的同位置文件换过来之后解决了问题。

总结:
1、用开源代码时,不要乱搞里面的文件。
2、有问题,先找官方源代码,病按照官方的说明配置环境并编译。
3、设置环境变量以及其他时,要按照官方的要求来,不要随意升高降低不同包的版本。 同时在很久没有接触某一个开源代码时,先不要慌着编译,要先找官方说明匹配了环境之后再编译。
事后想起我出现这些问题的时候,也使用过重新下载的官方代码进行编译,也是出现错误没有编译成功,想来多半是因为环境、java版本等没有设置好的原因。

该版本要求的是gradle 6.9.3、 java13。我尝试了 gradle6.9.3/7.3.3/7.6/8.7,java8、11/13/17,瞎折腾

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值