![](/img/trans.png)
[英]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.