我在 github.com 上有一个 Maven 项目:
<project ...>
...
<groupId>com.example</groupId>
<artifactId>my-github-library</artifactId>
<packaging>jar</packaging>
<version>1.0.0</version>
...
</project>
Run Code Online (Sandbox Code Playgroud)
现在我想将 my-github-library 添加为另一个 my-local-application 项目的依赖项:
<project ...>
...
<groupId>com.example</groupId>
<artifactId>my-local-application</artifactId>
<packaging>jar</packaging>
<version>1.0.0</version>
...
<dependencies>
...
<dependency>
<groupId>com.example</groupId>
<artifactId>my-github-library</artifactId>
<version>1.0.0</version>
</dependency>
...
</dependencies>
...
</project>
Run Code Online (Sandbox Code Playgroud)
这当然不起作用,因为 GitHub 不是 Maven 存储库。
如何向项目 pom 文件中添加额外的 Maven 存储库?
我有以下项目结构:
应用/的build.gradle:
apply plugin: 'java'
Run Code Online (Sandbox Code Playgroud)
settings.gradle:
include ':application'
Run Code Online (Sandbox Code Playgroud)
的build.gradle:
task custom << {
project.tasks.getByName("build").execute()
}
Run Code Online (Sandbox Code Playgroud)
所以我想在任务"custom"中执行任务"build".但是当我运行"gradle custom"时,结果是:
:custom FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '/tmp/test/build.gradle' line: 3
* What went wrong:
Execution failed for task ':custom'.
> Task with name 'build' not found in root project 'test'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED …
Run Code Online (Sandbox Code Playgroud)