already found a lot of entries here to fix my problem, but none of this worked. I have no idea what I'm doing wrong ... I always get 403 on tomcat. I am using Apache Tomcat version 7.0.32
Output:
[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Homeserver 1.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> tomcat-maven-plugin:1.1:deploy (default-cli) @ homeserver >>> [INFO] [INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ homeserver --- [WARNING] Using platform encoding (ISO-8859-1 actually) to copy filtered resources, ie build is platform dependent! [INFO] skip non existing resourceDirectory /home/pi/git/homeserver/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ homeserver --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) @ homeserver --- [WARNING] Using platform encoding (ISO-8859-1 actually) to copy filtered resources, ie build is platform dependent! [INFO] skip non existing resourceDirectory /home/pi/git/homeserver/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ homeserver --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ homeserver --- [INFO] Surefire report directory: /home/pi/Maven/homeserver/surefire-reports ------------------------------------------------------- TESTS ------------------------------------------------------- Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-war-plugin:2.4:war (default-war) @ homeserver --- [INFO] Packaging webapp [INFO] Assembling webapp [homeserver] in [/home/pi/Maven/homeserver/homeserver-1.0] [INFO] Processing war project [INFO] Copying webapp resources [/home/pi/git/homeserver/WebContent] [INFO] Webapp assembled in [1759 msecs] [INFO] Building war: /home/pi/Maven/homeserver/homeserver-1.0.war [INFO] [INFO] <<< tomcat-maven-plugin:1.1:deploy (default-cli) @ homeserver <<< [INFO] [INFO] --- tomcat-maven-plugin:1.1:deploy (default-cli) @ homeserver --- [INFO] Deploying war to http:
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany.app</groupId> <artifactId>homeserver</artifactId> <version>1.0</version> <packaging>war</packaging> <name>Homeserver</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.1.2</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> </dependency> <dependency> <groupId>javax.servlet.jsp.jstl</groupId> <artifactId>javax.servlet.jsp.jstl-api</artifactId> <version>1.2.1</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.26</version> </dependency> </dependencies> <build> <sourceDirectory>${project.basedir}/src/</sourceDirectory> <testSourceDirectory>${project.basedir}/src/</testSourceDirectory> <directory>${env.MVNTarget}/${project.artifactId}</directory> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration> <archive> <manifestFile>${project.basedir}/WebContent/META-INF/MANIFEST.MF</manifestFile> <manifest> <addClasspath>true</addClasspath> </manifest> </archive> <warSourceDirectory>${project.basedir}/WebContent</warSourceDirectory> <webXml>${project.basedir}/WebContent/WEB-INF/web.xml</webXml> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <url>http://localhost:8080/manager/text</url> <server>TomcatServer</server> <path>/Homeserver</path> </configuration> </plugin> </plugins> </build> </project>
/etc/maven/settings.xml
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <pluginGroups> </pluginGroups> <proxies> </proxies> <servers> <server> <id>localhost</id> <username>admin</username> <password>s3cret</password> </server> </servers> <mirrors> </mirrors> <profiles> </profiles> </settings>
/usr/local/tomcat/conf/tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="manager-gui"/> <role rolename="manager-script"/> <user username="admin" password="s3cret" roles="manager-gui,manager-script"/> </tomcat-users>
When running mvn -X tomcat: deploy, I see the following debug output, which may be the root cause:
[DEBUG] Configuring mojo 'org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy' with basic configurator --> [DEBUG] (f) charset = ISO-8859-1 [DEBUG] (f) contextFile = /home/pi/Maven/homeserver/homeserver-1.0/META-INF/context.xml [DEBUG] (f) ignorePackaging = false [DEBUG] (f) mode = war [DEBUG] (f) packaging = war [DEBUG] (f) path = /homeserver [DEBUG] (f) update = false [DEBUG] (f) url = http://localhost:8080/manager [DEBUG] (f) version = 1.1 [DEBUG] (f) warFile = /home/pi/Maven/homeserver/homeserver-1.0.war [DEBUG] -- end configuration -- [INFO] Deploying war to http://localhost:8080/homeserver [DEBUG] No server specified for authentication - using defaults
I already used in pom.xml
<url>http://localhost:8080/manager/html</url>
that also didn’t change. Does anyone know what is wrong here?
thanks in advance and with respect
EDIT: Thanks first for the answers, I tried everything, but without success. Now I have set up my Windows PC for Maven. Even with the modified POM:
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <configuration> <server>TomcatServer</server> <url>http://192.168.34.252:8080/manager/text</url> <path>/mycontext</path> </configuration> </plugin>
still trying to deploy it to localhost:
[DEBUG] Configuring mojo 'org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy' with basic configurator --> [DEBUG] (f) charset = ISO-8859-1 [DEBUG] (f) contextFile = C:\temp\homeserver\homeserver-1.0\META-INF\context.xml [DEBUG] (f) ignorePackaging = false [DEBUG] (f) mode = war [DEBUG] (f) packaging = war [DEBUG] (f) path = /homeserver [DEBUG] (f) update = false [DEBUG] (f) url = http://localhost:8080/manager [DEBUG] (f) version = 1.1 [DEBUG] (f) warFile = C:\temp\homeserver\homeserver-1.0.war [DEBUG] -- end configuration -- [INFO] Deploying war to http://localhost:8080/homeserver [DEBUG] No server specified for authentication - using defaults
So it seems that he has sth. do with pom ...