maven:从属性文件中读取sonar.login

问题描述 投票:0回答:1

我正在尝试设置sonar.login属性,以使其位于pom.xml之外。我尝试使用codehaus中的properties-maven-plugin,但是它看不到该属性(而且我没有看到太多有关如何调试它的信息,就像正在读取的属性文件和它检索到的值)。

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>properties-maven-plugin</artifactId>
        <version>1.0.0</version>
        <executions>
          <execution>
            <phase>initialize</phase>
            <goals>
              <goal>read-project-properties</goal>
            </goals>
            <configuration>
              <files>
                <file>${basedir}/sonar.properties</file>
              </files>
            </configuration>
          </execution>
        </executions>
      </plugin>

其中的属性文件具有以下内容:

sonar.login=some-value

唯一有效的方法是在mvn调用上设置属性:

mvn -Dsonar.login=some-value sonar:sonar

如何获取这些属性文件以使mvn sonar:sonar正常工作?

maven properties sonarqube properties-file
1个回答
0
投票
<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>properties-maven-plugin</artifactId>
            <version>1.0.0</version>
            <executions>
                <execution>
                    <phase>initialize</phase>
                    <goals>
                        <goal>read-project-properties</goal>
                    </goals>
                    <configuration>
                        <files>
                            <file>${basedir}/sonar.properties</file>
                        </files>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build> 

插件应保留在内部版本中

© www.soinside.com 2019 - 2024. All rights reserved.