Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

how do you do conditionals or loops in maven?


You don't. If you need to run custom code in the build you have to encapsulate that as a plugin (which will be a first-class maven module in its own right, which naturally nudges you to writing unit tests, having a proper release process with semver and so on for your build step). But mostly you keep your build simple and declarative and you put any business logic in the actual code. It's wonderful.


> how do you do conditionals or loops in maven?

What you're asking for is Turing-complete XML.

History has shown that this is usually a mistake.


Or maybe he's asking for a non-XML Turing-complete configuration.


You can use the maven polyglot plugin [1] to write your POM in something other than XML. It's fairly new, but it's there. We use it in JRuby to write our POMs in Ruby. As an example of a loop:

https://github.com/jruby/jruby/blob/8e29ae1302e7aa989b8808f7...

[1] -- https://github.com/takari/polyglot-maven


Why can't I use Java with Polyglot?


I don't know much about the development of the project, simply that it exists and is usable. I'd file an issue with the project and see what comes of it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: