3
votes

I am trying to use the eclipse maven plugin but when using the command:

tomcat7:deploy I am getting build successful with lots of html output explaining about adding users, I have added the user to tomcat with only manager-script. and added that to the user of settings.xml in maven.

What am I doing wrong?

From the tomcat logs

127.0.0.1 - - [29/Aug/2012:23:50:34 +0100] "PUT /manager/text/deploy?path=%2F HTTP/1.1" 401 2486

my cofigurations

pom.xml

        <plugins>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.0-SNAPSHOT</version>
            <configuration>
                <server>tomcat_7</server>
                <port>8180</port>
                <path>/</path>
                <url>http://localhost:8180/manager/text</url>
            </configuration>
          </plugin>
    </plugins>

settings.xml

<server>
  <id>tomcat_7</id>
  <username>admin</username>
  <password>secret</password>
</server>

tomcat-users.xml

<user username="admin" password="secret" roles="manager-script" />
2
It looks the authentication does not work based on the 401 error code? Have you checked that just by using a browser? - khmarbaise
I have tried using the browser to visit /manager/text and get a message saying fail. Using the tomcat plugin without using eclipse, but only using the command line the deployment works fine. Any ideas why its not working through eclipse. - Paul

2 Answers

2
votes

OK so I managed to fix the problem.

I checked where the eclipse thought the maven settings.xml file was. This was the main problem, there was no settings.xml file therefore no authentication. I coppied the file to the path specified in eclipse.

The build is now successful.

0
votes

Remove

<server>tomcat_7</server>

and add

<username>admin</username>
<password>s3cret</password>

to rule out any maven settings.xml issues.