我们有一个多模块 Maven 项目,由一个父 POM 和 5 个或更多模块组成。
如果我们激活我们的自定义“自动部署”配置文件,每个模块都可以作为构建的一部分部署到正在运行的服务器,因为每个模块的部署方式/部署内容略有不同,因此在每个模块中明确定义了该配置文件。
但是,当从父 POM 构建时,如果我激活“自动部署”配置文件,Maven 将最终部署所有模块,这几乎从来不是我们需要做的(基于我们的开发流程等)。但是我们确实希望从根构建,因为多个模块之间可能会发生变化,并且某些模块之间存在依赖关系。
当从父 POM 构建时,有没有办法只为一个模块而不是所有模块激活我们的自定义“自动部署”配置文件?
谢谢
我正在开发一个大型的基于Maven的多模块系统,该系统具有大约20个子模块以及少量的项目外部依赖关系,这些依赖关系也是我的Eclipse工作区中的Maven项目。总而言之,Eclipse工作区中大约有30个项目。
这些项目都是使用m2e导入的maven项目,我们使用Subversion(带有Subversive插件)进行源代码控制。Eclipse是最近更新的开普勒。
我的工作站功能强大,配备4核Intel i7 CPU,16 Gb RAM和固态硬盘。
问题在于,Eclipse在以下方面非常慢:
团队同步和解决冲突。每次我解决冲突并“标记为已合并”时,我都必须等待10-30秒以使Eclipse刷新工作空间等。更不用说冲突模式树视图随后会完全清除,因此我必须选择传出模式,然后再次以冲突模式填充。两次-因为它会在我保存解析的源文件时清除,然后在我标记为合并时清除。
建造。我使用Maven启动配置来进行Maven构建。但是由于某些原因,对于Eclipse而言,进行Maven构建是不够的-然后,它也必须对整个工作区进行自己的构建,这至少需要花费同样长的时间,而当Eclipse决定在“清除”上暂停几分钟时,则需要更长的时间。项目xxx'的输出文件夹,用于多个项目。
所有这些的结果是,通常需要一个多小时来从源代码管理进行更新,解决冲突,构建并准备运行或继续进行开发。
我和我的同事们经常觉得Eclipse在应该加强开发的同时阻碍了开发。
有什么办法可以减少永恒的食候综合征?
我们有一个大型的多模块 Maven 项目。我一直在尝试使用 -T 选项加速我们的单元测试构建,并取得了一些积极的结果。但是,我们的项目中有一些依赖路径是这样的:
模块 A <- 模块 B <- 模块 C
每个模块的单元测试需要 20-30 分钟。由于 -T 选项按其相关顺序构建模块,因此总构建时间为 90 分钟。如果我可以先编译所有模块,然后并行运行 A、B 和 C 的测试,那真的会加快构建速度。例如。像这样的东西:
$ mvn -T 10 clean install -DskipTests
$ mvn -T 10 --ignore-dependencies test
Run Code Online (Sandbox Code Playgroud)
问题:Maven 是否支持开箱即用?
我一直在考虑编写一个小脚本的想法,该脚本将解析 mvn dependency:tree 的输出并并行调用“mvn test -pl A”、“mvn test -pl B”等,但显然如果 Maven有一个开箱即用的解决方案,这将是更可取的。
我们正在使用 Jenkins,所以如果有一些 Jenkins 插件或我错过的 Jenkins 功能支持这一点,那会很有帮助!
注意:加速 A、B 和 C 的单元测试将需要大量工作,并且不能保证单个模块中的测试是可并行的
最近我们尝试使用 jenkins 来部署文件${revision},为构建提供属性(Maven 3.3.9)。它在0.0.1-SNAPSHOT为开发构建和0.0.1-RC发布创建 json 时工作正常,但我们在开发人员机器上使用 maven 时遇到问题。我们有一个多模块 maven 项目,其版本定义在 parent 中,一些模块使用其他模块作为依赖项。两者都从 jenkins 构建它并在本地使用 maven,在将其推送到存储库之前与 IDE 集成并运行测试。当我们尝试构建单个模块时,maven 无法识别${revision},尽管当我们提到所有模块时它工作正常,例如mvn clean install -pl appserver,我们看到
Failed to execute goal on project appserver: Could not resolve dependencies for project com.org:appserver:war:0.0.1-local: Failed to collect dependencies at com.org:my-kinesis-events:jar:0.0.1-local: Failed to read artifact descriptor for com.org:my-kinesis-events:jar:0.0.1-local: Could not transfer artifact com.org:my-parent:pom:${revision} from/to central: Failed to transfer .../repository/maven-central/com/org/my-parent/${revision}/my-parent-${revision}.pom. Error code 500, Server Error -> [Help 1]
我们尝试使用:
-Drevision=0.0.1-local …
I've split my pancakes Gradle-based library written in Kotlin into multiple modules: pancakes-core, pancakes-addon1, ..., pancakes-addonN. The addon ones include the core one.
Now, most users shouldn't care and will just want the default configuration with all the dependencies included. But they will have to write boilerplate:
dependencies {
implementation("pancakes:pancakes-core")
implementation("pancakes:pancakes-addon1")
...
implementation("pancakes:pancakes-addonN")
}
Run Code Online (Sandbox Code Playgroud)
This is a no-go for me. I'll probably have to merge all the modules, although I've just spent some time to branch off …
对于我的多模块项目中的发布过程/准备,我想在选定的一组模块(网络应用程序)中运行其他目标。例如:
pom.xml (parent/root)
|-- common-module/pom.xml
|-- some-webapp/pom.xml
|-- some-other-module/pom.xml
|-- some-other-webapp/pom.xml
|-- (...more modules to follow)
Run Code Online (Sandbox Code Playgroud)
webapp-module(s)(应该)使用maven-frontend-plugin来运行一些自定义的npm和grunt任务(基本上,模仿release:prepare在Java中为我们的JS依赖项所做的检查和修改)。
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>${version.release.plugin}</version>
<configuration>
<preparationGoals>frontend:grunt@update-static-resource-to-latest-stable frontend:npm@npm-update frontend:npm@npm-update</preparationGoals>
<completionGoals>frontend:grunt@update-static-resource-to-latest frontend:grunt@check-static-resources-version</completionGoals>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
目标之一的示例(phase none以便它在其他任何时候都不会运行):
<execution>
<id>update-static-resource-to-latest-stable</id>
<phase>none</phase>
<goals>
<goal>grunt</goal>
</goals>
<configuration>
<arguments>latestStable</arguments>
</configuration>
</execution>
Run Code Online (Sandbox Code Playgroud)
因此,我(认为我)需要一些准备目标和完成目标才能在mvn release:prepare调用时运行。在发布准备期间触发它们的任何其他机制都可以,但是,我不想/无法手动运行其他命令。
我尝试过什么:
1:将preparementGoals和completionGoals添加到build特定模块的-section中,但是对release-plugin的任何配置更改显然都需要对根POM进行。
2:为每个(webapp-)模块创建一个发布配置文件,修改发布插件配置以添加准备和完成目标,但它发布配置文件似乎只能在release:perform.
我一直在尝试创建一个多模块应用程序,其中每个功能都是一个独立的库(模块)。单一活动模式应用于整个项目。
该结构由一个包含MainActivity的“ app ”模块组成。
由其他模块继承的核心模块。
并针对应用程序的三个不同功能提供三个模块。这三个模块与“ app ”模块一起实现了“核心”
在“ MainActivity ”中有一个BottomNavigationView,用于在不同的屏幕(片段)之间导航用户。它有三个选项卡,用于三个不同的功能。
我为不同的模块创建了不同的 navGraphs 并将它们包含在应用程序的 navGraph 中,但我无法让它工作。
问题:我应该如何使用带有 BottomNavigationView 的导航组件在不同屏幕之间导航?
链接到 git repo。这是我到目前为止所取得的进展。
我有两个模块(editor和engine)与一个公共数据库一起工作。对于我想使用的脚本的部署liquibase。我不想在两个地方复制相同的脚本,我想在一个地方管理它们。为此,我创建了一个单独的模块 ( database-structure),其中仅包含我的脚本和参数spring .liquibase.change-log=classpath:db/changelog/db.changelog-master.xml。我已将此模块 ( database-structure)添加为其他模块的依赖项。最终结构如下(为了紧凑,省略了类):
D:\PROJECTS\MY-PROJECT
????database-structure
? ? pom.xml
? ?
? ????src
? ????main
? ? ????java
? ? ????resources
? ? ? application.properties
? ? ?
? ? ????db
? ? ????changelog
? ? ? db.changelog-master.xml
? ? ?
? ? ????1.0
? ? db.changelog-1.0.xml
? ? metadata_create.sql
? ? metadata_insert_data.sql
? ? metadata_rollback.sql
? ?
? ????test
? ????java
????editor
? ? pom.xml
? ? …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 kotlin 和 spring 构建一个多模块 Maven 项目。当 kotlin-maven-plugin 运行编译阶段时出现错误。
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ starter ---
[INFO] Deleting /Users/pnts/IdeaProjects/getyour/base/starter/target
[INFO]
[INFO] --- git-commit-id-plugin:2.2.6:revision (default) @ starter ---
[INFO]
[INFO] --- git-commit-id-plugin:2.2.6:revision (get-the-git-infos) @ starter ---
[INFO]
[INFO] --- kotlin-maven-plugin:1.3.41:compile (compile) @ starter ---
[INFO] Applied plugin: 'spring'
[ERROR] /Users/pnts/IdeaProjects/getyour/base/starter/src/main/kotlin/org/getyour/webdesign/PlainStarter.kt: (6, 9) Unresolved reference: WebsiteEntryPoint
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for parent 0.0.1-SNAPSHOT:
[INFO]
[INFO] parent ............................................. SUCCESS [ 1.178 s]
[INFO] common ............................................. SUCCESS [ …Run Code Online (Sandbox Code Playgroud)我有基于 java 和 kotlin 的多模块 gradle 项目。我正在尝试为此设置声纳分析。我在根项目中配置了声纳并使用 CircleCI 运行分析。sonarcloud 中的结果仅针对一个子项目。
我的项目结构如下:
这是我的根 build.gradle。
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61'
classpath 'io.spring.gradle:dependency-management-plugin:1.0.9.RELEASE'
classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.2.4.RELEASE'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7"
}
}
ext {
springCloudVersion = 'Hoxton.SR1'
springBootVersion = '2.2.4.RELEASE'
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
allprojects {
group = 'com.organiz'
version = '1.0.0-SNAPSHOT'
repositories {
mavenCentral()
maven {
// url ="s3url" // only for releases
url ="s3url" // only for snapshots
credentials(AwsCredentials) {
accessKey project.accessKey …Run Code Online (Sandbox Code Playgroud) multi-module ×10
maven ×6
java ×4
build ×2
gradle ×2
jenkins ×2
kotlin ×2
android ×1
android-architecture-navigation ×1
eclipse ×1
liquibase ×1
performance ×1
project ×1
sonarqube ×1
spring ×1
spring-boot ×1
unit-testing ×1