我一直在拼命尝试使用ROS2和PX4,但我无法编译所有必要的包:Fast RTPS Gen
让人们了解PX4:
- 我使用的是安装了sdk的Gradle 6.3版本,正如PX4网站上所解释的那样
- 我已经从Fast RTPS Gen存储库下载了1.0.4版本
当我尝试用Gradle编译它时,我有一个证书(见问题的末尾(。
我的问题是:我该如何绕过它?由于我不打算在Java上开发任何东西,我只需要这一点来编译,我真的很感兴趣的是绕过证书检查的最快、最脏的方法。我试着用keystol从Maven repo添加一个证书,但我就是无法使用它。
> Task :buildIDLParser FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '/home/evandro/Fast-RTPS-Gen/thirdparty/idl-parser/idl.gradle' line: 89
* What went wrong:
Could not determine the dependencies of task ':idl-parser:jar'.
> Could not resolve all files for configuration ':idl-parser:compile'.
> Could not resolve org.antlr:antlr4:4.5.
Required by:
project :idl-parser
> Could not resolve org.antlr:antlr4:4.5.
> Could not get resource 'https://repo.maven.apache.org/maven2/org/antlr/antlr4/4.5/antlr4-4.5.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/org/antlr/antlr4/4.5/antlr4-4.5.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
> Could not resolve org.antlr:antlr4:4.5.
Required by:
project :idl-parser
> Could not resolve org.antlr:antlr4:4.5.
> Could not get resource 'https://repo.maven.apache.org/maven2/org/antlr/antlr4/4.5/antlr4-4.5.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/org/antlr/antlr4/4.5/antlr4-4.5.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
> Could not resolve org.antlr:stringtemplate:3.2.
Required by:
project :idl-parser
> Could not resolve org.antlr:stringtemplate:3.2.
> Could not get resource 'https://repo.maven.apache.org/maven2/org/antlr/stringtemplate/3.2/stringtemplate-3.2.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/org/antlr/stringtemplate/3.2/stringtemplate-3.2.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
* 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
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.4/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 653ms
4 actionable tasks: 2 executed, 2 up-to-date
据我所知,不可能通过配置禁用JVM证书验证。由于https://repo.maven.apache.org
的证书验证失败,这在大多数系统上都不应该发生,我猜你是在公司防火墙后面。
如果您在Windows上,请尝试将环境变量JAVA_TOOL_OPTIONS
设置为(确切地(:
-Djavax.net.ssl.trustStoreType=Windows-ROOT -Djavax.net.ssl.trustStore=NUL
如果你在Mac上,请尝试将其设置为:
-Djavax.net.ssl.trustStoreType=KeychainStore -Djavax.net.ssl.trustStore=/dev/null
如果这些都不起作用,您可以复制JVM的现有密钥库,并使用keytool
将您的公司证书添加到其中,这很容易在谷歌上查找。在这种情况下,您将在env-var:中使用这些设置
-Djavax.net.ssl.trustStore=/my/trust_store -Djavax.net.ssl.trustStorePassword=my_password
通过使用sudo:进行编译来解决问题
sudo env "PATH=$PATH" gradle assemble
我花了一整天的时间,因为我对gradle一无所知,而它最终只是一个愚蠢的简单解决方案。我建议在PX4安装指南中添加此注释。