Skip to main content

๐Ÿ‘ฉโ€๐Ÿ’ป ไฝฟ็”จ Maven ๆ‰“ๅŒ… spring boot

  • pom.xml ไธญๆŒ‡ๅฎš application.properties
  <!--้–‹็™ผ็’ฐๅขƒ-->
<profile>
<id>dev</id>
<activation>
<!--้ป˜่ช้–‹ๅ•Ÿ้–‹็™ผ็’ฐๅขƒ-->
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!--profile.activeๅฐๆ‡‰application.propertiesไธญ็š„@profile.active@-->
<profile.active>dev</profile.active>
</properties>
</profile>
<!--ๆธฌ่ฉฆ็’ฐๅขƒ-->
<profile>
<!--ไธๅŒ็’ฐๅขƒ็š„ๅ”ฏไธ€id-->
<id>test</id>
<properties>
<profile.active>test</profile.active>
</properties>
</profile>
<!--ๆญฃๅผ็’ฐๅขƒ-->
<profile>
<id>prod</id>
<properties>
<profile.active>prod</profile.active>
</properties>
</profile>
</profiles>
  • ๆŒ‡ไปค
mvn clean package -P [ๆŒ‡ๅฎš็š„่จญๅฎšๆช”]