반응형
DeployToTomcatUsingMaven
- .m2/settings.xml 을 만든다.
- Servers 에 Server를 설정한다.
- Pom.xml에 Server를 Setting 한다.
- 다음의 명령을 날려주면 된다.
D:\temp\simple-webapp>mvn tomcat:deploy + Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'tomcat'. [INFO] ------------------------------------------------------------------------ [INFO] Building simple-webapp Maven Webapp [INFO] task-segment: [tomcat:deploy] [INFO] ------------------------------------------------------------------------ [INFO] Preparing tomcat:deploy [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] [INFO] No sources to compile [INFO] [resources:testResources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:testCompile] [INFO] No sources to compile [INFO] [surefire:test] [INFO] No tests to run. [INFO] [war:war] [INFO] Packaging webapp [INFO] Assembling webapp[simple-webapp] in [D:\temp\simple-webapp\target\simple-webapp] [INFO] Processing war project [INFO] Webapp assembled in[31 msecs] [INFO] Building war: D:\temp\simple-webapp\target\simple-webapp.war [INFO] [tomcat:deploy] [INFO] Deploying war to http://localhost:8081/simple-webapp [INFO] OK - Deployed application at context path /simple-webapp [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2 seconds [INFO] Finished at: Thu May 08 11:23:47 KST 2008 [INFO] Final Memory: 7M/14M [INFO] ------------------------------------------------------------------------
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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.sonatype.maven.ch05</groupId> <artifactId>simple-webapp</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>simple-webapp Maven Webapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <build> <finalName>simple-webapp</finalName> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <configuration> <server>myserver</server> <url>http://localhost:8081/manager</url> </configuration> </plugin> </plugins> </build> </project>
setting.xml
<settings> <localRepository/> <interactiveMode/> <usePluginRegistry/> <offline/> <!--proxies> <proxy> <active/> <protocol/> <username/> <password/> <port/> <host/> <nonProxyHosts/> <id/> </proxy> </proxies--> <servers> <server> <username/> <password/> <privateKey/> <passphrase/> <filePermissions/> <directoryPermissions/> <configuration/> <id/> </server> <server> <id>myserver</id> <username>admin</username> <password>password</password> </server> </servers> <mirrors> <mirror> <mirrorOf/> <name/> <url/> <id/> </mirror> </mirrors> <profiles> <profile> <activation> <activeByDefault/> <jdk/> <os> <name/> <family/> <arch/> <version/> </os> <property> <name/> <value/> </property> <file> <missing/> <exists/> </file> </activation> <properties/> <repositories> <repository> <releases> <enabled/> <updatePolicy/> <checksumPolicy/> </releases> <snapshots> <enabled/> <updatePolicy/> <checksumPolicy/> </snapshots> <id/> <name/> <url/> <layout/> </repository> </repositories> <pluginRepositories> <pluginRepository> <releases> <enabled/> <updatePolicy/> <checksumPolicy/> </releases> <snapshots> <enabled/> <updatePolicy/> <checksumPolicy/> </snapshots> <id/> <name/> <url/> <layout/> </pluginRepository> </pluginRepositories> <id/> </profile> </profiles> <activeProfiles/> <pluginGroups/> </settings>
반응형