<link rel="stylesheet" href="https://js.how234.com/third-party/SyntaxHighlighter/shCoreDefault.css" type="text/css" /><script type="text/javascript" src="https://js.how234.com/third-party/SyntaxHighlighter/shCore.js"></script><script type="text/javascript"> SyntaxHighlighter.all(); </script>
java dev是什么,让我们一起了解一下:
dev是java后端使用mvn的开发环境,通过pom.xml配置,mvn区分dev,pro,local三种环境,local代表本地环境,dev代表开发环境,pro代表生产环境。
dev常用在项目开发中,dev,test和prod又是什么意思?
开发环境(dev):开发环境是程序猿们专门用于开发的服务器,配置可以比较随意,为了开发调试方便,一般打开全部错误报告。
测试环境(test):一般是克隆一份生产环境的配置,一个程序在测试环境工作不正常,那么肯定不能把它发布到生产机上。
生产环境(prod):是指正式提供对外服务的,一般会关掉错误报告,打开错误日志。
dev开发环境具体示例代码如下:
<!--环境配置--> <profiles> <profile> <id>local</id> <properties> <!-- 环境标识,需要与配置文件的名称相对应 --> <activatedProperties>local</activatedProperties> </properties> </profile> <profile> <id>dev</id> <properties> <activatedProperties>dev</activatedProperties> </properties> <activation> <!-- 默认环境 --> <activeByDefault>true</activeByDefault> </activation> </profile> <profile> <id>pro</id> <properties> <activatedProperties>pro</activatedProperties> </properties> </profile> </profiles> <build> <resources> <resource> <!--配置文件路径 --> <directory>src/main/resources</directory> <!--这里对应项目存放配置文件的目录--> <!--开启filtering功能 --> <filtering>true</filtering> </resource> </resources> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <goals> <!--创建一个自动可执行的jar或war文件 --> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build>