
[英]Can VisualVM be used for profiling Maven Projects? If yes then how?
[英]How can I use maven profiling to a dependant
有没有一种方法可以在Maven分析中对个人类使用概要文件。
我的问题是,我在一个父项下有两个项目。 product-core-ws和product-core 。
product-core-ws是一个令人遗憾的Web服务 。现在,我想在product-core中创建两个配置文件,如下所示
<profiles>
<profile>
<id>one</id>
<dependencies>
<dependency>
<groupId>com.fg</groupId>
<artifactId>product-core-one</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>two</id>
<dependencies>
<dependency>
<groupId>com.fg</groupId>
<artifactId>product-core-two</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
</profiles>
当我clean install
product-core-ws时,我需要根据给定的配置文件进行依赖
例如,如果我使用
mvn全新安装-P一
,我需要在war文件中添加product-core-one。
我知道我可以直接在product-core-ws POM文件中执行此操作。 但是我不想在该POM中使用那些。 我想通过product-core使用它们。
在您的父POM中,使用配置文件来设置Maven属性的值:
<profiles>
<profile>
<id>one</id>
<properties>
<product.core.version>product-core-one</product.core.version>
</properties>
</profile>
<profile>
<id>two</id>
<properties>
<product.core.version>product-core-two</product.core.version>
</properties>
</profile>
</profiles>
然后在子模块中使用此属性:
<dependency>
<groupId>com.fg</groupId>
<artifactId>${product.core.version}</artifactId>
<version>${project.version}</version>
</dependency>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.