如何在 IntelliJ 中将项目库从一个项目复制到另一个项目?
How can I copy project libraries from one project into another one in IntelliJ?
我有一个项目库列表:
我找不到将库 export/copy 放入另一个项目的方法。
如何才能做到这一点?
如果您想将所有库从 gradle 项目复制到另一个 gradle 项目,您只需将 dependencies
部分从 build.gradle
文件复制到 build.gradle
来自另一个项目。通常您的构建文件如下所示:
...
repositories {
mavenCentral() // that's where the gradle gets all libraries for project
}
dependencies { // it's the list of dependencies are used for your project
implementation 'library1Name'
implementation 'library2Name'
...
}
...
对于基于 Gradle(或 Maven)的项目,在 IDE 提取您在 build.gradle (pom.xml) 文件中配置的依赖项后,它将它们存储在项目配置文件中在项目级别。请参阅文档的 Libraries and Global Libraries 部分。
您确实可以将库移动到全局库,使它们在您的其他项目中可用,这些项目可能不使用 Maven 或 Gradle 来管理依赖项:
我有一个项目库列表:
我找不到将库 export/copy 放入另一个项目的方法。
如何才能做到这一点?
如果您想将所有库从 gradle 项目复制到另一个 gradle 项目,您只需将 dependencies
部分从 build.gradle
文件复制到 build.gradle
来自另一个项目。通常您的构建文件如下所示:
...
repositories {
mavenCentral() // that's where the gradle gets all libraries for project
}
dependencies { // it's the list of dependencies are used for your project
implementation 'library1Name'
implementation 'library2Name'
...
}
...
对于基于 Gradle(或 Maven)的项目,在 IDE 提取您在 build.gradle (pom.xml) 文件中配置的依赖项后,它将它们存储在项目配置文件中在项目级别。请参阅文档的 Libraries and Global Libraries 部分。
您确实可以将库移动到全局库,使它们在您的其他项目中可用,这些项目可能不使用 Maven 或 Gradle 来管理依赖项: