ÃֽŠ°Ô½Ã±Û(OS/WAS)
2018.06.15 / 19:53

Ä¿¸Çµå¶óÀο¡¼­ Maven/java À¥ ÇÁ·ÎÁ§Æ®¸¦ Tomcat¿¡ ¹èÆ÷ÇÏ·Á¸é?

¸®¾ó¸®
Ãßõ ¼ö 133

Ä¿¸Çµå¶óÀο¡¼­ Maven/java À¥ ÇÁ·ÎÁ§Æ®¸¦ Tomcat¿¡ ¹èÆ÷ÇÏ·Á¸é?

leave a comment »

java À¥ ¾ÖÇø®ÄÉÀ̼ÇÀ» Tomcat¿¡ ¹èÆ÷ÇÏ·Á¸é ¿©·¯ °¡Áö ¹æ¹ýÀÌ ÀÖ´Ù.

1. À¥ ¾ÖÇø®ÄÉÀÌ¼Ç µð·ºÅ丮 Àüü¸¦ webapps ¹Ø¿¡ Á÷Á¢ º¹»çÇϰųª,
2. À¥ ¾ÖÇø®ÄÉÀÌ¼Ç µð·ºÅ丮¸¦ ¾ÐÃàÇÑ WAR ÆÄÀÏÀ» webapps ¹Ø¿¡ Á÷Á¢ º¹»çÇϰųª,
3. TomcatÀÇ ¸Å´ÏÀú À¥ GUI¸¦ ÅëÇØ, WAR ÆÄÀÏÀ» ¹èÆ÷ÇÒ ¼ö ÀÖ´Ù.

±×·¯³ª, Á÷Á¢ ƯÁ¤ µð·ºÅ丮¿¡ º¹»çÇÏ´Â ¹æ¹ýÀº ¹«¾ùº¸´Ù ¹ø°Å·Ó´Ù.
TomcatÀÇ ¸Å´ÏÀú À¥À» ÅëÇØ ¹èÆ÷ÇÏ´Â °ÍÀº ½±Áö¸¸, ÀÚµ¿À¸·Î ¹èÆ÷¸¦ ÇÏ°íÀÚ ÇÑ´Ù¸é ¸Å¹ø
»ç¿ëÇϱ⠾î·Æ´Ù.

´ÙÀ½°ú °°Àº °æ¿ì, Cargo¶ó´Â ÇÁ·Î±×·¥/ Ç÷¯±×ÀÎÀ» »ç¿ëÇϸé ÁÁÀ» °Í °°´Ù.
1. Ä¿¸Çµå¶óÀÎÀ¸·ÎºÎÅÍ À¥ ¾ÖÇø®ÄÉÀ̼ÇÀ» ¹èÆ÷ÇÏ°í ½Í´Ù.
2. WAS°¡ ·ÎÄÃ/¸®¸ðÆ®·Î Á¢±Ù °¡´ÉÇÏ´Ù.
3. Ant/ MavenÀ» »ç¿ëÇÏ°í ÀÖ´Ù.
4. WAS°¡ ´Ù¸¥ °ÍÀ¸·Î ´ëüµÉ °¡´É¼º, ȤÀº ¼­·Î ´Ù¸¥ WAS°¡ ³» À¥ ¾ÖÇø®ÄÉÀ̼ǿ¡ È¥¿ëµÉ ¼öµµ ÀÖ´Ù.
5. ±×·¯³ª, µ¿ÀÏÇÑ ¹æ¹ýÀ¸·Î À¥ ¾ÖÇø®ÄÉÀ̼ÇÀ» ¿©ÀüÈ÷ ¹èÆ÷ÇÏ°í ½Í´Ù. (Ä¿¸Çµå¶óÀÎÀ¸·ÎºÎÅÍ)

Cargo¿¡ ´ëÇÑ Á¤È®ÇÏ°í, ÀÚ¼¼ÇÑ Á¤º¸´Â ¹«¾ùº¸´Ù °ø½Ä ȨÆäÀÌÁö(http://cargo.codehaus.org)¸¦ ÂüÁ¶ÇÏ´Â °ÍÀÌ
¹Ù¶÷Á÷ÇÏ´Ù.

ȨÆäÀÌÁöÀÇ What is CARGO?¶õ¿¡¼­´Â ´ÙÀ½°ú °°ÀÌ Cargo¸¦ ¼Ò°³ÇÏ°í ÀÖ´Ù.
Cargo is a thin wrapper that allows you to manipulate various type of application containers
(Java EE and others) in a standard way.

ÁÖ¸ñÇÒ ¸¸ÇÑ °ÍÀº °á±¹, various type of application containers in a standard way¶ó°í º¸¸é µÉ µí ÇÏ´Ù.

*  Cargo°¡ Áö¿øÇÏ´Â Containers
– Geronimo 1.x ~ 3.x
– Glassfish 2.x ~ 4.x
– JBoss 3.x ~ 7.4.x
– Jetty 4.x ~ 9.x
– Jo! 1.x
– JOnAS 4.x ~ 5.x
– JRun 4.x
– Orion/OC4J 9.x ~ 10.x
– Resin 2.x ~ 4.x
– Tomcat 4.x ~ 8.x
– TomEE 1.x
– WebLogic 8.x ~ 12.1.x
– WebSphere 8.5.x
– WildFly 8.x

* Standard way = CargoÀÇ »ç¿ë¹ý + container º° ¼³Á¤
¾Õ¼­ ¾ð±ÞÇÑ ´Ù¾çÇÑ WASµéÀº °á±¹ ¸î¸î property¸¦ ¼±¾ðÇϴ ȯ°æ ¼³Á¤ÀÇ ¹®Á¦·Î ±¹ÇѵȴÙ.
º» ±Û¿¡¼­´Â Maven ±â¹Ý À¥ ¾ÖÇø®ÄÉÀ̼ÇÀ» Tomcat7¿¡ ¹èÆ÷ÇÏ´Â ¼³Á¤À» °£´ÜÇÏ°Ô Àû¾îº¸°íÀÚ ÇÑ´Ù.

1. Tomcat ¼³Á¤
Tomcat¿¡´Â ±âº»ÀûÀ¸·Î ±ÇÇÑ ¹× ·êÀÌ µî·ÏµÇ¾î ÀÖÁö ¾Ê±â ¶§¹®¿¡ Cargo¸¦ »ç¿ëÇÏ¿© À¥ ¾ÖÇø®ÄÉÀ̼ÇÀ» ¹èÆ÷ÇÏ·Á¸é
±×¿¡ ÇÊ¿äÇÑ ³»¿ëÀ» ¼±¾ðÇØ¾ß ÇÑ´Ù.

TomcatÀÇ ¼³Ä¡ µð·ºÅ丮¸¦ $CATALINA_HOMEÀ̶ó ÇÒ ¶§, $CATALINA_HOME/conf/tomcat-users.xmlÀ» ÆíÁýÇÏ¿©,
´ÙÀ½ÀÇ ³»¿ëÀ» Ãß°¡ÇÑ´Ù.

1
2
<role rolename="manager-script" />
<user username="deploy" password="deploy" roles="manager-script" />

GUI ±â¹ÝÀÌ ¾Æ´Ñ, CLI ±â¹ÝÀ¸·Î Á¦¾îÇϱâ À§ÇØ, tomcat¿¡ manager-script ·ÑÀ» ¼±¾ðÇÑ´Ù.
¹èÆ÷¿¡ »ç¿ëÇÒ °èÁ¤ ¹× Æнº¿öµå¸¦ ¼±¾ðÇÏ°í (À§ÀÇ ¿¹¿¡¼­´Â deploy/deploy), ÀÌ °èÁ¤¿¡ ¾Õ¼­ ¼±¾ðÇÑ manager-script ·ÑÀ»
ºÎ¿©ÇÑ´Ù.

2. Maven ¼³Á¤
Cargo ȨÆäÀÌÁö»óÀÇ Downloads ÅÇÀ¸·ÎºÎÅÍ ´Ù¿î·Îµå¸¦ ¹ÞÀ» ¼öµµ ÀÖÀ¸³ª,
Maven ±â¹ÝÀ¸·Î ¼³Á¤ÇÒ °æ¿ì´Â, º»¹®¿¡ Ç¥±âµÈ ¹Ù¿Í °°ÀÌ
If you want to use Cargo from Maven 2 or Maven 3, you don¡¯t need to install anything at all as Maven will automatically download the required jars when you first use the plugin.

ÀúÀý·Î º¹»ç°¡ µÈ´Ù°í ÇÏ¿´À¸³ª, ÀúÀý·Î º¹»ç°¡ µÇµµ·Ï ¼³Á¤À» ÇØÁà¾ß ÇÑ´Ù.

http://repo1.maven.org/maven2/org/codehaus/cargo/cargo-maven2-plugin
¿¡ Á¢¼ÓÇÏ¿© È®ÀÎÇϸé,

2014/7/28¿¡ ¹èÆ÷µÈ 1.4.9°¡ ÀÌ ±ÛÀ» ÀÛ¼ºÇÏ´Â ½ÃÁ¡ ±âÁØÀ¸·Î °¡Àå ÃֽŹöÀüÀÌ´Ù.
º» ±ÛÀº, ¿¹Àü¿¡ 1.2.4·Î Å×½ºÆ® ȯ°æÀ» ±¸ÃàÇÑ °ÍÀ» ¹ÙÅÁÀ¸·Î ÀÛ¼ºÇÏ¿´±â¿¡, ¾Æ·¡
¼³Á¤¿¡´Â 1.2.4·Î ±â·ÏÇÏ¿´´Ù. (1.4.9·Î Àû¾îµµ µ¿ÀÏÇÏ°Ô µ¿ÀÛÇÒ °ÍÀÌ¶ó ¿¹»óÇÑ´Ù.)

pom.xml¿¡ cargo-maven2-plugin ¼³Á¤À» ÇÏÀÚ.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.2.4</version>
    <configuration>
        <container>
            <containerId>tomcat7x</containerId>
            <type>remote</type>
        </container>
 
        <configuration>
            <type>runtime</type>
            <properties>
                <cargo.remote.uri>http://tomcat_ip:tomcat_port/manager/text</cargo.remote.uri>
                <cargo.remote.username>username</cargo.remote.username>
                <cargo.remote.password>password</cargo.remote.password>
            </properties>
        </configuration>
     
        <deployer>
            <type>remote</type>
            <deployables>
                <deployable>
                    <groupId>com.luran</groupId>
                    <artifactId>jsweb</artifactId>
                    <type>war</type>
                    <properties>
                        <context>/jsweb</context>
                    </properties>
                </deployable>
            </deployables>
        </deployer>
    </configuration>
</plugin>

– cargo.remote.uri ¿¡ Tomcat manager ÁÖ¼Ò¸¦ http://ip:port/manager/text·Î ±â·Ï
– cargo.remote.username¿¡ ¹èÆ÷¸¦ À§ÇÑ °èÁ¤ ±â·Ï
– cargo.remote.password¿¡ ¹èÆ÷¸¦ À§ÇÑ °èÁ¤ÀÇ ºñ¹Ð¹øÈ£ ±â·Ï
– deployableÀÌÇÏ ³»¿ë¿¡´Â ¾î¶² war·Î ¹èÆ÷ÇÒ °ÍÀÎÁö (maven Çü½Ä) ±â·Ï
– properties~context¿¡´Â, servlet context ¸í ±â·Ï (º» ¿¹Á¦¿¡¼­´Â, http://ip:port/jswebÀ¸·Î ¹èÆ÷ÇÔ)

3. MavenÀ» ÅëÇÑ, À¥ ¾ÖÇø®ÄÉÀÌ¼Ç °ü¸®
– deploy

1
mvn cargo:deploy

¶Ç´Â

1
mvn cargo:deployer-deploy

– undeploy

1
mvn cargo:undeploy

¶Ç´Â

1
mvn cargo:deployer-undeploy

– redeploy

1
mvn cargo:redeploy

¶Ç´Â

1
mvn cargo:deployer-redploy

4. ÀÚµ¿ ¹èÆ÷ ÀÀ¿ë (ºôµå ¼­¹ö ¶Ç´Â ½ºÅ©¸³Æ® »ó)

1
mvn clean install package cargo:redploy

ÀÌ¿Í °°Àº ½ÄÀ¸·Î ÀÛ¼ºÇÑ´Ù¸é, ºôµå±îÁö ¸ðµÎ ÇÑ ÈÄ Cargo¸¦ ÅëÇØ TomcatÀ¸·Î À¥ ¾ÖÇø®ÄÉÀ̼ÇÀ»
ÀÚµ¿ ¹èÆ÷ÇÒ ¼ö ÀÖ´Ù.