0

I've seen maven plugins setting configurations tied to goals. I'd like to do that with my tomcat7-maven-plugin. However, this doesn't seem to work; when I run deploy it's defaulting to localhost. Does this plugin not accept different configs or am I doing something wrong?

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <executions>
        <execution>
            <id>deploy</id>
            <goals>
                <goal>deploy</goal>
                <goal>redeploy</goal>
            </goals>
            <configuration>
                <url>${tomcat-manager-url}/manager/text</url>
                <username>${tomcat-manager-username}</username>
                <password>${tomcat-manager-password}</password>
                <path>/${project.artifactId}1</path>
            </configuration>
        </execution>
        <execution>
            <id>run</id>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <path>/</path>
            </configuration>
        </execution>
    </executions>
</plugin>
Community
  • 1
  • 1
end-user
  • 2,845
  • 6
  • 30
  • 56
  • When you're saying you're running `deploy`, you mean the Maven command you're using is `mvn clean deploy`? – Tunaki Nov 10 '16 at 17:38
  • Sorry, should have specified: `mvn tomcat7:[re]deploy` or `mvn tomcat7:run` – end-user Nov 10 '16 at 17:39
  • Ah, then this is normal, you missed [this comment of mine](http://stackoverflow.com/questions/33146819/different-maven-configurations-for-different-goals/33147058#comment54120135_33147058) on the linked question. You're using the default execution with this command, which is different than the ones you configured. See also http://stackoverflow.com/questions/38815961/maven-dependency-plugin-ignores-outputdirectory-configuration – Tunaki Nov 10 '16 at 17:43
  • ugh. that's irritating. – end-user Nov 10 '16 at 17:51
  • I amended [my answer you linked](http://stackoverflow.com/a/33147058/1743880) over there, to include the rationale behind this as well. – Tunaki Nov 10 '16 at 17:59

0 Answers0