简体   繁体   中英

Maven filtering - custom patterns

in many files (JAVA, XML, properties) I have custom patterns like

@datasource.jndiname 

or

@jms.destination.name.

In my parent POM I have already defined the values for replacing these pattern but I have no idea how to do it. All the discussions here are talking about patterns like

${db.driverClass}.

Could somebody help me?

this works by filtering resources like described here . But this is normaly only used for eg properties-files or similar, not source-files (*.java).

Set of delimiters for expressions to filter within the resources. These delimiters are specified in the form beginToken*endToken. If no * is given, the delimiter is assumed to be the same for start and end.

So, the default filtering delimiters might be specified as:

<delimiters>
  <delimiter>${*}</delimiter>
  <delimiter>@</delimiter>
</delimiters>

Since the @ delimiter is the same on both ends, we don't need to specify @*@ (though we can).

Please check the delimiters section here:

https://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM