Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iterate over ... just one item #11

Closed
JeromeRauline opened this issue Jan 23, 2014 · 1 comment
Closed

Iterate over ... just one item #11

JeromeRauline opened this issue Jan 23, 2014 · 1 comment

Comments

@JeromeRauline
Copy link

Hi,

I can't implement my use case with the plugin right now. My use case =>
I want to install my WebApp on multiple environnements, let say : dev, test, prod.
In test there are 2 Tomcat instances, prod 3 isntance, and just one in dev.

So I want my build to auto adjust the number of times I invoke the tomcat plugin to install my WAR file. My idea was to declare some properties in profiles.

So for 1 instance I want to set a property tomcatUrl
For 2 instances : tomcatUrl, tomcatUrl2
For n instances : tomcatUrl, tomcatUrl2, ... tomcatUrlN

I'm trying to use the plugin to iterate over a list, calculated at runtime by another Mojo that check how many properties starting with tomcatUrl are set.
Then I create a content with ,2,...N, and configure tomcat install mojo with ${tomcatUrl@item@}
It works great !

BUT, if only the first one is set, my content looks like so the plugin invoke nothing.
That's because, in AbstractIteratorMojo the getItems() methods check with isContentSet() there is a non empty value.
And in my case, I don't want to rename my first var as tomcatUrl1 ....

So i'd like

Prop 1) a new property to allow empty item ==> no trim() in isContentSet().
Prop 2) change the getItems() to not check if the content is set

protected List<String> getItems() throws MojoExecutionException {
    List<String> result = new ArrayList<String>();
    if (isItemsSet()) {
        result = items;
    } else {
        result = getContentAsList();
    } 

    return result;
}
@khmarbaise
Copy link
Owner

Can you create a simple project which reproduces the problem. Best might be to create a github project or make a attachment to the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants