gpt4 book ai didi

maven-3 - 如何在 Maven 中启动单个目标/执行

转载 作者:行者123 更新时间:2023-12-02 01:17:45 25 4
gpt4 key购买 nike

目前我正在调试 Android 应用程序的签名。如果我可以只执行这个唯一的插件,这会容易得多:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
</goals>
<phase>package</phase>

但无论我尝试什么,我得到的都是:

[ERROR] Could not find goal 'signing' in plugin org.apache.maven.plugins:maven-jarsigner-plugin:1.2 among available goals verify, sign, help -> [Help 1]
org.apache.maven.plugin.MojoNotFoundException: Could not find goal 'signing' in plugin org.apache.maven.plugins:maven-jarsigner-plugin:1.2 among available goals verify,
sign, help

org.apache.maven.lifecycle.LifecyclePhaseNotFoundException: Unknown lifecycle phase "sign". You must specify a valid lifecycle phase or a goal in the format <plugin-pre
fix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources
, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-co
mpile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, p
ost-clean, pre-site, site, post-site, site-deploy.

或其他错误。

最佳答案

您可以使用此命令仅运行符号目标:

mvn jarsigner:sign

我有这个插件配置是我的 pom 是这样的:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>signer</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>target/${project.artifactId}-${project.version}.jar</archive>
<keystore>src/main/signer/.keystore</keystore>
<alias>MyCert</alias>
<storepass>password</storepass>
<keypass>password</keypass>
</configuration>
</plugin>

因为我有<archive>指向我的目标目录中的工件我必须运行 mvn clean install首先,从那时起我可以执行 mvn jarsigner:sign如果我想再次运行 maven-jarsigner-plugin 来签署 jar。 (我通常不会只运行这个插件/目标,因为我只是一直执行完整的“mvn clean install”,但它确实有效。)

关于maven-3 - 如何在 Maven 中启动单个目标/执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9159002/

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