(转)在eclipse激活maven profile配置

本文介绍如何在Eclipse中激活Maven配置文件中的不同环境配置。通过两种方法实现:一是通过项目属性设置;二是通过运行配置进行指定。这有助于开发者在不同操作系统间共享项目并确保正确的依赖和路径。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

How to activate maven profile inside eclipse

Normally maven is use for project dependency management and lifecycle, so there are several developers working on it. Each has its own development environment either in windows, linux or mac. To do this we create several profiles for each developer in pom.xml. 

 <profiles>
  <profile>
   <id>windows</id>
   <properties>
    <jboss.home>C:/manaty/jboss-4.2.3.GA</jboss.home>
   </properties>
  </profile>
  <profile>
   <id>linux</id>
   <properties>
    <jboss.home>/home/project/jboss-4.2.3.GA</jboss.home>
   </properties>
  </profile>
 </profiles>

And then invoke mvn with the -P argument. Example: 

mvn install -Pwindows
mvn install -Plinux

How could we do the same inside eclipse. There are 2 ways: 1.) Right click on the project->click properties->select maven menu



 

If in case maven is not present, right click on project->Maven->Enable Maven Dependency 2.) Right click on project->Run As->Run Configurations->Maven Build->Add a new build (set profile and goal) 



 
 
转自:http://czetsuya-tech.blogspot.com/2011/11/how-to-activate-maven-profile-inside.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值