gpt4 book ai didi

shell - maven exec exec ,引用其他 jar 中的脚本

转载 作者:行者123 更新时间:2023-12-04 23:52:14 25 4
gpt4 key购买 nike

我在从另一个插件的 exec 插件中调用 shell 脚本时遇到了一些问题,这完全可以做到吗?

我有一个名为 scripts 的项目打包为一个 jar,在那个项目中我想把我所有的 shell 脚本从不同的项目中调用它们,例如:我想从不同的项目中调用 s3sync,我已经添加了依赖项另一个项目到我的脚本项目,但我似乎可以执行我没有得到这样的文件或目录,我的配置:

<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.2.1</version>
<executions>
<execution>
<id>PrepFIle</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${aws.s3.deploy.skip}</skip>
<executable>chmod</executable>
<arguments>
<argument>777</argument>
<argument>s3sync.sh</argument>
<!--<argument>${project.build.outputDirectory}/s3sync.sh</argument>-->
</arguments>
</configuration>
</execution>
<execution>
<id>RunFile</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${aws.s3.deploy.skip}</skip>
<workingDirectory>${project.build.outputDirectory}</workingDirectory>
<!--<executable>${project.build.outputDirectory}/s3sync.sh</executable>-->
<executable>s3sync.sh</executable>
<arguments>
<argument>${aws.s3.bucket.name}</argument>
<argument>${project.build.outputDirectory}</argument>
</arguments>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.company</groupId>
<artifactId>scripts</artifactId>
<version>0.0.1</version>
<type>jar</type>
</dependency>
</dependencies>
</plugin>

这完全可以做到吗?我尝试了很多变体……我可以将 jar 与脚本打包在一起……我知道我可以用其他方式做到这一点,但我需要以这种方式执行它

最佳答案

我认为您必须首先从脚本 jar 中解压 shell scipts 并执行脚本的解压版本。可以使用 maven-dependency-plugin 解压脚本。 .使用 upack目标。你可以找到一个例子 here .

关于shell - maven exec exec ,引用其他 jar 中的脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9261054/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com