Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/374.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过maven命令行传递java属性文件密钥_Java_Maven_Command Line_Bamboo_Properties File - Fatal编程技术网

通过maven命令行传递java属性文件密钥

通过maven命令行传递java属性文件密钥,java,maven,command-line,bamboo,properties-file,Java,Maven,Command Line,Bamboo,Properties File,我在src/main/java/configs/config.properties下有一个config.properties文件,其中包含以下配置文件: <profiles> <profile> <id>default</id> <activation> <activeByDefault>true</activeByDefault>

我在src/main/java/configs/config.properties下有一个config.properties文件,其中包含以下配置文件:

 <profiles>
    <profile>
        <id>default</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <no_of_files>${no_of_files}</no_of_files>
            <no_of_rows>${no_of_rows}</no_of_rows>
        </properties>
    </profile>
</profiles>
但结果是

[ERROR] Resolving expression: '${no_of_files}': Detected the following recursive expression cycle in 'no_of_files': [no_of_files] @
我已经研究了stackoverflow的其他类似答案,但我认为我仍然没有找到正确的方法


我需要这个来运行使用竹作业的项目。

您不需要任何Maven的趣味性来执行此操作:

public class App {

    public static void main(String ...args) {

        // Load value from -Dno_of_files=
        Integer noOfFiles = Integer.getInteger("no_of_files");

        // Load value from -Dno_of_rows=
        Integer noOfRows = Integer.getInteger("no_of_rows");
    }

}
根本不需要config.properties和maven概要文件

如果您真的想在属性文件中生成值,那么这是一个更复杂的答案

public class App {

    public static void main(String ...args) {

        // Load value from -Dno_of_files=
        Integer noOfFiles = Integer.getInteger("no_of_files");

        // Load value from -Dno_of_rows=
        Integer noOfRows = Integer.getInteger("no_of_rows");
    }

}