【发布时间】:2018-12-12 01:51:53
【问题描述】:
我已经根据您的项目创建了 Docker 映像,但是 docker run 抛出错误:找不到或加载主类 org.gradle.wrapper.GradleWrapperMain.Here is dockerfile 如果您想调试和运行并帮助我修复此错误
FROM OpenJDK:8-JDK-alpine
WORKDIR /opt
RUN wget -q https://services.gradle.org/distributions/gradle-3.3-bin.zip
&& unzip gradle-3.3-bin.zip -d /opt
&& rm gradle-3.3-bin.zip
RUN echo "$PWD"
RUN apk add git
RUN git clone https://github.com/TechieTester/gatling-fundamentals.git
RUN echo "$PWD"
RUN cp -vif /opt/gatling-fundamentals/gradlew /opt/gradle-3.3/bin/
RUN mv -vif /opt/gatling-fundamentals/src/* /opt/gradle-3.3/bin/
RUN find /opt/
RUN chmod 777 /opt/gradle-3.3/bin/gradlew
ENV GRADLE_HOME /opt/gradle-3.3
ENV PATH $PATH:/opt/gradle-3.3/bin
使用以下命令在本地成功创建 docker 映像后
docker build -t fromscratch4:local .
尝试使用以下命令运行 请注意,我已使用
授予对 gradlew 的完全访问权限chmod 777 gradlew
你会在下面看到一个错误...请帮助
PS C:\Gatling2\gatling6games> docker run --rm -w /opt/gatling-fundamentals/
fromscratch4:local sh -c "gradle wrapper | gradlew gatlingRun
simulations.RuntimeParameters"
Error: Could not find or load main class
org.gradle.wrapper.GradleWrapperMain
【问题讨论】:
-
嗨,玛格丽特,欢迎来到 SO!。你为什么要执行
cp -vif /opt/gatling-fundamentals/gradlew /opt/gradle-3.3/bin/?gradlew在那个项目中 的全部目的是它会下载the gradle 4.5.1 it wants to use。我也不明白你为什么要运行gradle wrapper并将其输出传送到gradlew;这是非常非常非常奇怪的 -
对不起,我对 docker 很陌生,因此尝试了所有可行的方法,实际上我只需要执行以下命令 ./gradlew gatlingRun simulations.RuntimeParameters 这是一个名为 gatling performance 的工具的执行......我正在使用的 github 存储库是 github.com/TechieTester/gatling-fundamentals.git..above github 存储库在我的本地窗口中完美工作,现在我想 dockerise,请帮助
-
@MatthewLDaniel 这是命令 ./gradlew gatlingRun simulations.RuntimeParameters 我想用 docker run 执行,我尝试用 docker run --rm -w /opt/gatling-fundamentals/ fromscratch4 映射到 cmd 以上:local grad lew gatlingRun simulations.RuntimeParameters 但同样的错误
-
如果您花一点时间来学习如何use the formatting,尤其是@987654332 @ 使它们更清晰
-
我的意思是你只想运行
git clone https://...部分,然后确保你运行./gradlew gatlingRun simulations.RuntimeParameters(带有前导点正斜杠:./但安装单独的 gradle 只是让您的情况变得更糟,尤其是因为您正在安装的版本非常旧
标签: docker gradle gatling scala-gatling