我有一个自定义插件,可以压缩我需要包含在我的 Maven 构建中的文件。所以我把这个插件包含在我的pom.xml:
<build>
// Other tags
<plugin>
<groupId>someGroupId</groupId>
<artifactId>somePlugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
由于它是一个自定义插件,因此在任何公共 Maven 存储库中都不可用。因此,每当我尝试构建时,都会收到一条错误消息:
Failed to read artifact .....
Run Code Online (Sandbox Code Playgroud)
即使我已将它添加到我的本地存储库。我如何引用我本地存储库中的这个插件?
如果您指的是经典意义上的本地存储库,请确保您正确安装了插件 jar。使用以下命令将其再次安装到本地存储库:
mvn install:install-file -Dfile=/some/path/somePlugin.jar -DgroupId=someGroupId -DartifactId=somePlugin -Dversion=1.0.0 -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true
Run Code Online (Sandbox Code Playgroud)
然后您应该能够在您的 Maven 构建中使用您的插件。
如果您指的是某个本地托管存储库的意义上的本地,则需要将包含您的工件的存储库指定为pluginRepository. 将以下内容添加到您的顶层pom.xml:
<pluginRepositories>
<pluginRepository>
<id>some-repo</id>
<name>Some Repository</name>
<url>http://some.host/some/path</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9089 次 |
| 最近记录: |