Different files to be packaged in a Maven war project

前端 未结 2 1724
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-06 14:00

I have a war packaging Maven project, in which I have a Java properties files called myapp.properties. In this properties file, I store some parameters, for example, databas

2条回答
  •  遥遥无期
    2021-01-06 14:24

    i would try it with

    pom.xml for your project (or parent pom)

            
              ...
            
                src/main/resources
                
                    **/*.properties
                
                true
            
             ...
            
    

    in your properties file(s) e.g.

    db.url=${db.url}
    

    and in your settings.xml (see http://maven.apache.org/settings.html#Profiles)

    jdbc:mysql://localhost:3306/testdb
    

    depending on your development stage (local, build server, etc.) you can use different db.url values

    this will not leave the db.url property blank, but each time you package the artifact you dont want it really to stay blank do you ?

提交回复
热议问题