Maven:如何从命令行激活配置文件?
这是我的pom.xml的片段。我尝试了以下操作,但未激活配置文件。 mvn clean install -Pdev1 mvn clean install -P dev1 当我尝试时,mvn help:active-profiles没有任何配置文件被列为活动状态。如果我设置<activeByDefault>为dev1要true,并运行 mvn help:active-profiles,它给我展示了配置文件被激活。 <profile> <id>dev1</id> <activation> <activeByDefault>false</activeByDefault> </activation> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <systemPropertyVariables> <env>local</env> <properties.file>src/test/resources/dev1.properties</properties.file> </systemPropertyVariables> <suiteXmlFiles> <suiteXmlFile>src/test/resources/dev1.testng.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin> </plugins> </build> </profile> <profile> <id>dev2</id> <activation> <activeByDefault>false</activeByDefault> </activation> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <systemPropertyVariables> <env>local</env> …