How to change tomcat default port when creating executable jar using tomcat7-maven-plugin?

65 Views Asked by At

I am using below snippet in pom.xml to create a executable jar file for my web application, it is creating the jar file properly and i am able to access it on port 8080. Now i want to change this default port. i tried many things but none of them helped.

**<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.0</version>
    <executions>
        <execution>
            <id>tomcat7-run</id>
            <goals>
                <goal>exec-war-only</goal>
            </goals>
            <phase>package</phase>
            <configuration>
                <path></path>
                <enableNaming>false</enableNaming>
                <finalName>Univer.jar</finalName>
                <charset>utf-8</charset>
            </configuration>
        </execution>
    </executions>
</plugin>**

-> Tried below command, Tomcat is not coming up when i try this.

java -jar Univer.jar -httpPort=9091

-> Tried below tags as well with no luck.

<configuration> 
   <maven.tomcat.port>9090</maven.tomcat.port>
   <httpPort>9090</httpPort> 
   <maven.tomcat.httpPort>9090</maven.tomcat.httpPort>
</configuration>

-> Also, tried -DServer.port, even i specified port 9090, application is accessible on 8080 only.

java -Dserver.port=9090 -jar Univer.jar

Any help on this is greatly appreciated, I can provide more info if anything needed.

0

There are 0 best solutions below