<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WAR &#8211; 記下來</title>
	<atom:link href="https://noter.tw/tag/war/feed/" rel="self" type="application/rss+xml" />
	<link>https://noter.tw</link>
	<description>一路上踩到的坑、遇到的問題，一點一滴記下來，希望能幫助到需要的人~</description>
	<lastBuildDate>Wed, 06 Nov 2019 14:15:29 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.3</generator>

<image>
	<url>https://noter.tw/wp-content/uploads/cropped-old-1130742_1920-1-32x32.jpg</url>
	<title>WAR &#8211; 記下來</title>
	<link>https://noter.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>將專案匯出 / 匯入 WAR 檔</title>
		<link>https://noter.tw/3117/%e5%b0%87%e5%b0%88%e6%a1%88%e5%8c%af%e5%87%ba%e5%8c%af%e5%85%a5-war-%e6%aa%94/</link>
					<comments>https://noter.tw/3117/%e5%b0%87%e5%b0%88%e6%a1%88%e5%8c%af%e5%87%ba%e5%8c%af%e5%85%a5-war-%e6%aa%94/#comments</comments>
		
		<dc:creator><![CDATA[黃小蛙]]></dc:creator>
		<pubDate>Fri, 18 Oct 2013 10:00:38 +0000</pubDate>
				<category><![CDATA[一般程式]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Struts]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[WAR]]></category>
		<guid isPermaLink="false">http://wazai.net/?p=3117</guid>

					<description><![CDATA[<p>在 Struts2 設置筆記 (Hello World 級^^) 中提到 Struts2 的設置環境，但是如果每次要開發一個 Struts 2 專案就要做一次這些事情有點麻煩，如果只是要空白的 WAR&#46;&#46;&#46;</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/3117/%e5%b0%87%e5%b0%88%e6%a1%88%e5%8c%af%e5%87%ba%e5%8c%af%e5%85%a5-war-%e6%aa%94/" data-wpel-link="internal">將專案匯出 / 匯入 WAR 檔</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>在 <a href="https://noter.tw/2905/struts2-%e8%a8%ad%e7%bd%ae%e7%ad%86%e8%a8%98-hello-world-%e7%b4%9a/" target="_blank" rel="noopener noreferrer" data-wpel-link="internal">Struts2 設置筆記 (Hello World 級^^)</a> 中提到 Struts2 的設置環境，但是如果每次要開發一個 Struts 2 專案就要做一次這些事情有點麻煩，如果只是要空白的 WAR，Struts2 下載下來裡面就已經有了，這邊小蛙記錄把一個基礎建置好的 Struts 2 專案(包含已經加入了常用的設定、套件、架構 &#8230; 等) 匯出成 WAR。<br />
<span id="more-3117"></span>要把專案匯出成 WAR 非常簡單，只要在要匯出的專案上</p>
<pre>點選滑鼠右鍵
-&gt; Export
-&gt; Export ...
-&gt; Web
-&gt; WAR file
-&gt; Web project: (選取要匯出的專案)
-&gt; Destination: (選擇要存的檔案及路徑)
-&gt; Optimize for a specific server runtime: (選擇自己用的 Server 也可以不選)
-&gt; Export source file (是否要包含程式碼)
-&gt; Override existing file (覆蓋既有檔案)
-&gt; Finish</pre>
<p>小蛙一開始沒有勾選 Export source file，造成把 WAR 專案解回來的時候發現裡面只有一堆 class 跟 jar，完全沒有半點原始檔 &#8230; 再包一次記得要把這個打勾，如果是要把專案佈署到 tomcat 上的話，就可以不用勾選這個選項。<br />
接著是匯入的步驟，在 Eclipse 上</p>
<pre>點選滑鼠右鍵
-&gt; Import
-&gt; Import ...
-&gt; Web
-&gt; WAR file
-&gt; WAR file: (選擇剛剛匯出的檔案)
-&gt; Web Project: (要匯入專案的名字)
-&gt; Target runtime: (Server 環境，可不設定) 
-&gt; Next
-&gt; WAR Import: (如果 WAR 專案裡面的只有用到別人的 library，這裡不要勾選)
-&gt; Finish</pre>
<p>上面的 WAR Import 小蛙第一次不太瞭解意思就勾選了，結果 Eclipse 中就多了一堆專案，Eclipse 把所有用到的 JAR，例如：ojdbc14.jar 也匯入成一個 ojdbc 專案。<br />
這邊還有一個地方要修改，小蛙也不知道為什麼匯回去的專案路徑跟原始匯出時的不同，從</p>
<pre>Project
-&gt; Properties
-&gt; Java Build Path
-&gt; Source
-&gt; Default output folder: MyProject/WebContent/WEB-INF/classes</pre>
<p>從 WAR 匯回的專案卻變成系統預設</p>
<pre>Default output folder: MyNewProject/build/classes</pre>
<p>這邊要把新專案設定回原本的路徑，否則可能會造成一些找不到 class 或是路徑錯誤的問題！</p>
<p>這篇文章 <a rel="nofollow" href="https://noter.tw/3117/%e5%b0%87%e5%b0%88%e6%a1%88%e5%8c%af%e5%87%ba%e5%8c%af%e5%85%a5-war-%e6%aa%94/" data-wpel-link="internal">將專案匯出 / 匯入 WAR 檔</a> 最早出現於 <a rel="nofollow" href="https://noter.tw" data-wpel-link="internal">記下來</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://noter.tw/3117/%e5%b0%87%e5%b0%88%e6%a1%88%e5%8c%af%e5%87%ba%e5%8c%af%e5%85%a5-war-%e6%aa%94/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
