2015-06-04 26 views
0

我正在使用Maven 3.2.3。如果文件系統上不存在文件,我該如何激活配置文件?我曾嘗試以下,但發現<not>語法不支持:如果文件不存在,我如何激活Maven配置文件?

  <profile> 
        <id>create-test-mysql-props-file</id> 
        <activation> 
          <file> 
            <not><exists>${basedir}/src/main/myfile</exists></not> 
          </file> 
        </activation> 
        <build> 
          <plugins> 
            <!-- Generate mysql datasource properties --> 
            <plugin> 
              <groupId>org.codehaus.mojo</groupId> 
              <artifactId>properties-maven-plugin</artifactId> 
              <version>1.0-alpha-2</version> 
              <executions> 
                <execution> 
                  <phase>process-resources</phase> 
                  <goals> 
                    <goal>write-project-properties</goal> 
                  </goals> 
                  <configuration> 
                    <outputFile> 
                      ${project.build.outputDirectory}/mysql_datasource.properties 
                    </outputFile> 
                  </configuration> 
                </execution> 
              </executions> 
            </plugin> 
          </plugins> 
        </build> 
      </profile> 

回答

相關問題