亚洲日本在线观看视频,久草免费在线色站,国产精品视频一区二区三区四蜜臂http://www.aygfsteel.com/nkjava/category/37575.html置身浩瀚的草原,方向最為重要,希望此blog能向大漠駝鈴一樣,給我方向和指引。zh-cnSat, 14 Feb 2009 11:50:25 GMTSat, 14 Feb 2009 11:50:25 GMT60maven 中使用jetty原始文章http://www.aygfsteel.com/nkjava/archive/2009/02/14/254684.html草原上的駱駝草原上的駱駝Sat, 14 Feb 2009 09:37:00 GMThttp://www.aygfsteel.com/nkjava/archive/2009/02/14/254684.htmlhttp://www.aygfsteel.com/nkjava/comments/254684.htmlhttp://www.aygfsteel.com/nkjava/archive/2009/02/14/254684.html#Feedback0http://www.aygfsteel.com/nkjava/comments/commentRss/254684.htmlhttp://www.aygfsteel.com/nkjava/services/trackbacks/254684.htmlApache Wicket
Maven Jetty plugin
Edit Page   Browse Space   Add Page   Add News
Added by Martin Funk, last edited by Adam Mathias Bittlingmayer on Jan 09, 2008  (view change)

Using the Maven Jetty plugin

This note is to describe the above plugin. which will run your web application in an embedded Jetty6 instance by just
typing "mvn jetty:run" - No need to download or install Jetty manually, it's all automatic once the Maven project
descriptor's set up (the pom.xml)

Configuring HowTo

Add the following to the <build><plugins> block of your projects pom.xml

<plugin>



<groupId>org.mortbay.jetty</groupId>



<artifactId>maven-jetty-plugin</artifactId>



</plugin>

Running

In order to run Jetty on a webapp project which is structured according to the usual Maven defaults, you don't need to configure anything.

Simply type:

mvn jetty:run

Due to a bug in maven or the maven-jetty-plugin this only works if no jetty artifact is present in the dependencies section of the pom.xml file. This is the case for wicket-quickstart, wicket-examples and wicket-threadtest. So the tips given here can't be applied to those projects.

Running the webapp in debug mode using Java Platform Debugger Architecture (JPDA)

Using maven command line:

I couldn't find a command line reference for maven2, but the one given for maven1 still aplies for the feature used here:

First set MAVEN_OPTS environment variable with the following command:

export MAVEN_OPTS='-Xdebug -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y'

After setting this property, run "maven jetty:run" and it will block, waiting for a debug connection. If "suspend=n" is set, it will start right away.

Using eclipse external tools:

Running Eclipse Open "Run --> External Tools --> External Tools... --> Program". Press "New launch configuration". On the "Main" tab, fill in the "Location:" as the full path to your "mvn" executable. For the "Working Directory:" select the workspace that matches your webapp. For "Arguments:" add jetty:run.

Move to the "Environment" tab and click the "New" button to add two new variables:

name value
MAVEN_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y
JAVA_HOME Path to your java executable

As above the jvm will start right away when "suspend=n" is set.

Attaching to the server running in debug mode, using eclipse:

Running Eclipse Open "Run --> Debug... --> Remote Java Application". Press "New launch configuration". Fill in the dialog by selecting your webapp project for the "Project:" field, and ensure you are using the same port number as you specified in the address= property above.

Now all you need to do is Run/Debug and select the name of the debug setup you setup above.

This article is a gathering of information, credits need to be given to the authors of the pages behind the given links.


 Eclipse中用Maven來啟動Jetty調試Web應用

1、先來配置一個外部工具,來運行JETTY:
 選擇菜單Run->External Tools->External Tools ...在左邊選擇Program,再點New:
 配置Location為mvn完整命令行。定位到bin下的mvn.bat
 選擇Working Directory為本項目。
 Arguments填寫:jetty:run
 再點選Enviroment頁:加入MAVEN_OPTS變量,值為:
 -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8080,server=y,suspend=y
 其中,如果suspend=n 表示不調試,直接運行。address=8080為端口
 然后,點APPLY,點擊Run啟動jetty
 
2、調試應用
 點選run->debug...
 選中左樹中的Remote Java Application,再點New。
 選擇你的項目,關鍵是要填和之前設置外部工具時相同的端口號,其它都不變。
 
注意:停止調試后,8080端口并沒有關閉,再運行run->debug后會報錯,具體原因沒有去深究。建議采用TcpView等工具關閉對應端口的進程



草原上的駱駝 2009-02-14 17:37 發表評論
]]>
Eclipse+maven+jetty開發環境搭建(轉自javaeye)http://www.aygfsteel.com/nkjava/archive/2009/02/14/254682.html草原上的駱駝草原上的駱駝Sat, 14 Feb 2009 09:07:00 GMThttp://www.aygfsteel.com/nkjava/archive/2009/02/14/254682.htmlhttp://www.aygfsteel.com/nkjava/comments/254682.htmlhttp://www.aygfsteel.com/nkjava/archive/2009/02/14/254682.html#Feedback0http://www.aygfsteel.com/nkjava/comments/commentRss/254682.htmlhttp://www.aygfsteel.com/nkjava/services/trackbacks/254682.html

 




草原上的駱駝 2009-02-14 17:07 發表評論
]]>
maven pom.xml介紹http://www.aygfsteel.com/nkjava/archive/2009/02/14/254680.html草原上的駱駝草原上的駱駝Sat, 14 Feb 2009 08:32:00 GMThttp://www.aygfsteel.com/nkjava/archive/2009/02/14/254680.htmlhttp://www.aygfsteel.com/nkjava/comments/254680.htmlhttp://www.aygfsteel.com/nkjava/archive/2009/02/14/254680.html#Feedback0http://www.aygfsteel.com/nkjava/comments/commentRss/254680.htmlhttp://www.aygfsteel.com/nkjava/services/trackbacks/254680.html 下面開始創建第一個項目,執行一下命令行:
Mvn archetype:create –DgroupId=com.mycompany.app –DartifactId=my-app
一旦執行了以上命令,你會發現maven為這個新項目創建了一個名為my-app的目錄,同時此目錄中有一個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.mycompany.app </groupId>

  <artifactId>my-app </artifactId>

  <packaging>jar </packaging>

  <version>1.0-SNAPSHOT </version>

  <name>Maven Quick Start Archetype </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>

</project>
Pom.xml包含項目對象模型(POM)。POM是Maven的基本單元,記住,Maven是以項目為中心的,所有的東西都圍繞項目展開。簡而言之,POM包含項目的所有重要信息,并且本質上提供了一站式的項目信息。關于pom的詳細介紹,請參考《POM介紹》。
下面是pom中的一些重要元素:
Ø      project:pom.xml文件中的頂層元素;
Ø      modelVersion:指明POM使用的對象模型的版本。這個值很少改動。
Ø      groupId:指明創建項目的組織或者小組的唯一標識。GroupId是項目的關鍵標識,典型的,此標識以組織的完全限定名來定義。比如,org.apache.maven.plugins是所有Maven插件項目指定的groupId。

Ø      artifactId:指明此項目產生的主要產品的基本名稱。項目的主要產品通常為一個JAR文件。第二,象源代碼包通常使用artifactId作為最 后名稱的一部分。典型的產品名稱使用這個格式: <artifactId>- <version>. <extension>(比如:myapp-1.0.jar)。

Ø      version:項目產品的版本號。Maven幫助你管理版本,可以經??吹絊NAPSHOT這個版本,表明項目處于開發階段。

Ø      name:項目的顯示名稱,通常用于maven產生的文檔中。

Ø      url:指定項目站點,通常用于maven產生的文檔中。

Ø      description:描述此項目,通常用于maven產生的文檔中。

POM中所有元素的說明,請參考《POM參考》。

產生了第一個項目的archetype后,你可以發現maven為你創建了如下的目錄結構:

my-app

|-- pom.xml

`-- src

    |-- main

    |  `-- java

    |      `-- com

    |          `-- mycompany

    |              `-- app

    |                  `-- App.java

    `-- test

        `-- java

            `-- com

                `-- mycompany

                    `-- app

                        `-- AppTest.java

從archetype產生的項目有一個POM,一個源代碼樹,以及一個測試代碼樹,這是maven項目的標準布局(應用程序源碼位 于${basedir}/src/main/java,而測試源碼位于${basedir}/src/test/java,這里${basedir}代表 包含pom.xml的根目錄)。


草原上的駱駝 2009-02-14 16:32 發表評論
]]>
使用Maven管理項目-----創建Struts2,Spring,Hibernate項目(轉載整理)http://www.aygfsteel.com/nkjava/archive/2009/02/14/254679.html草原上的駱駝草原上的駱駝Sat, 14 Feb 2009 08:30:00 GMThttp://www.aygfsteel.com/nkjava/archive/2009/02/14/254679.htmlhttp://www.aygfsteel.com/nkjava/comments/254679.htmlhttp://www.aygfsteel.com/nkjava/archive/2009/02/14/254679.html#Feedback0http://www.aygfsteel.com/nkjava/comments/commentRss/254679.htmlhttp://www.aygfsteel.com/nkjava/services/trackbacks/254679.html 關于Maven2的知識請看這里!
http://books.sonatype.com/maven-book/reference_zh/introduction.html
這是翻譯,還沒翻譯完,到16章,不過應該夠用了目前!
這里使用eclipse來開發Maven項目!eclipse需要一個插件,m2eclipse,目前應該是最強的Maven插件,非常的方便!待會就能體會到!
m2eclipse的安裝,看這里!
http://books.sonatype.com/maven-book/reference_zh/eclipse.html

還有關于Maven建立本地jar倉庫的內容,翻譯里面都有!

安裝完插件,就可以創建Maven項目了!Maven項目是基于原型的!創建完了,就是一個架子!
下面就可以創建Struts2+Spring+Hibernate項目了。非常非常的簡單,比Myeclipse的創建過程可能都簡單?。ㄓ卸螘r間沒用Myeclipse了。。)
1.new ->project->other...

2.第二步直接next即可
3.
這里是選擇Maven項目的原型!搜索一下,struts,就能找到了!點中需要的原型,next.
4
這里是Maven項目的相關內容??梢詤⒖忌厦娴姆g。
Group Id ,Artifact Id,Version唯一的確定了你的項目!
這里,Group Id可以隨便你寫,Artifact Id為項目的名稱,Version嘛。。。。不多說。
下面的Package是包嘛,隨你便咯!搞定,Finish即可!
然后,等吧!Maven會下載需要的jar文件!這可能會讓第一次使用Maven的人感覺到很不爽!至少我是很不爽!國內網速比較慢!所以下載需要不少時間!但是第一次下載完后,以后再建項目時它不會再下載的!
創建完成后,就項目就會像這個樣子!

是不是感覺很別扭!java文件在,src/main/java下面,資源文件在src/main/resources下面,還有對應的test目錄。這個應該是個習慣問題!慢慢就好!
目前這個項目是Struts2+Spring的項目!里面就有基本代碼!
發布內容在src/main/webapp下面,找到index.jsp,右擊,run on server即可運行了!
現在所有的java類都在src/main/java目錄下,下面并沒有struts.xml文件,它被放到了src/main/resources下面了,部署時會自動拷貝過去的!不用擔心!
現在添加Hibernate,打開pom.xml文件,在項目根目錄下!你會發現有很多的視圖方式,具體看上面的翻譯即可!
修改pom.xml文件,直接到代碼區,放心,不需要你敲任何代碼!右擊鼠標,找到Maven,add dependency,輸入hibernate,找到org.hibernate,點中需要的jar,點OK即可!我下過了,所以顯好紅 色!eclipse會自動的下載需要的依賴包!

這里面,Maven倉庫可能有點問題,jta包,1.0.1B版本沒有,所以,自己選擇jta1.1下載!

依然,是eclipse自動的下載jar,不需要你找到jar去copy到WEB-INF/lib下了!當然,只下載一次!
最后,當然就是配置Hibernate了,配置方法就不多說了吧!
使用Maven有什么好處呢?
首先是,jar統一管理了!如果建立了一個本地的jar倉庫,那么所有人都是從倉庫里面下載jar,拷貝項目時只需要copy幾K的源碼即可!
其次,依然是倉庫,使得每個人的jar版本都是一致的,不會出現因為版本不同,引起的莫名其妙的錯誤。
再來,項目的自動化,只需要mvn package命令,在eclipse里面,看run里面,只需要選擇就行了!它會自動的從編譯,測試開始,一直到打包,自動的運行,保證你的包沒有問題。
上面的作用對我沒什么誘惑力!我使用Maven是因為,可以在IDE之間自由的切換!
不知道大家有沒有這樣的經歷!eclipse創建的項目,要到netbeans或者idea下面跑,要修改一堆東西!
而現在,只要IDE裝了Maven插件,就可以隨便用IDE了。對于eclipse和idea。不裝Maven插件都可以,只需要在項目根目錄下運行 mvn eclipse:eclipse,mvn idea:odea。完成后,當作普通的eclipse,idea工程打開就可以了,非常的方便!
當然了,不喜歡Maven,只需要按以往的方式開發就可以了,只不過就是目錄結構不一樣了!

草原上的駱駝 2009-02-14 16:30 發表評論
]]>
maven2過程當中的總結(轉載)http://www.aygfsteel.com/nkjava/archive/2009/02/14/254649.html草原上的駱駝草原上的駱駝Sat, 14 Feb 2009 03:52:00 GMThttp://www.aygfsteel.com/nkjava/archive/2009/02/14/254649.htmlhttp://www.aygfsteel.com/nkjava/comments/254649.htmlhttp://www.aygfsteel.com/nkjava/archive/2009/02/14/254649.html#Feedback0http://www.aygfsteel.com/nkjava/comments/commentRss/254649.htmlhttp://www.aygfsteel.com/nkjava/services/trackbacks/254649.html下面是一些使用maven2過程當中的總結,有一些來自網絡,恕不一一提名。
最后提到兩個問題,是我一直沒有解決的,如果有用maven2的朋友也遇到那兩個問題,還請幫忙指導一下。
【常用命令】
mvn archetype:generate //創建 Maven 項目
mvn compile //編譯源代碼
mvn test-compile //編譯測試代碼
mvn test //運行應用程序中的單元測試
mvn site //生成項目相關信息的網站
mvn clean //清除目標目錄中的生成結果
mvn package //依據項目生成 jar 文件
mvn install //在本地 Repository 中安裝 jar
mvn eclipse:eclipse //生成 Eclipse 項目文件

【生成項目】
JAVA項目 mvn archetype:generate -DgroupId=com.demo -DartifactId=App
web 項目 mvn archetype:generate -DgroupId=com.demo -DartifactId=web-app -DarchetypeArtifactId=maven-archetype-webapp

【生成eclipse項目】
普通eclipse項目 mvn eclipse:eclipse
eclipse WTP項目 mvn eclipse:eclipse -Dwtpversion=1.0(wtp1.0+可用)
eclipse->file->import->General->Existing Projects into Workspace
Window->Preferences->Java->Build Path->Classpath Variables
New Name 命名:M2_REPO
路徑:本地的 maven 類庫地址(%USER_HOME%/.m2/repository)

【pom.xml 基本節點】
<project> 根節點
<modelversion> pom.xml 使用的對象模型版本
<groupId> 創建項目的組織或團體的唯一 Id
<artifactId> 項目唯一Id, 項目名
<packaging> 打包擴展名(JAR、WAR、EAR)
<version> 項目版本號
<name> 顯示名,用于生成文檔
<url> 組織站點,用于生成文檔
<description> 項目描述,用于生成文檔
<dependency>之<scope> 管理依賴部署

<scope> 可使用 5 個值:
compile 缺省值,用于所有階段,隨項目一起發布
provided 期望JDK、容器或使用者提供此依賴。如servlet.jar
runtime 只在運行時使用
test 只在測試時使用,不隨項目發布
system 需顯式提供本地jar,不在代碼倉庫中查找
【庫版本選擇】
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>[1.1,)</version>
</dependency>
表達式 含義
(,1.0] version<=1.0
[1.2,1.3] 1.2<=version<=1.3
[1.0,2.0) 1.0<=version<2.0
[1.5,) 1.5<=version
(,1.1),(1.1,) version!=1.1
【定義自己的結構】
1、新建 archetype 項目(模板項目):
mvn archetype:genera -DgroupId=org.simple -DartifactId=simple -DarchetypeArtifactId=maven-archetype-archetype
2、修改主要模板文件:archetype-resources/pom.xml
1)修改 META-INF/maven/archetype.xml 中相關的 sources
2)安裝此項目:mvn install
3、根據模板項目創建新項目:
mvn archetype:generate
-DarchetypeGroupId=org.simple"
-DarchetypeArtifactId= simple "
-DarchetypeVersion=1.0-SNAPSHOT

【安裝私有庫】
1、復制 mylib-1.2.3.jar 到本地代碼庫
2、編寫 mylib-1.2.3.pom 文件:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mylib</groupId>
<artifactId>mylib</artifactId>
<version>1.2.3</version>
</project>
如果有依賴關系,可以將依賴關系描述在 pom 中
3、用Ant 來生成 jar 包和 pom 文件的 checksum 文件:
build.xml:
<project default="checksum">
<target name="checksum">
<checksum file="mylib-1.2.3.jar" algorithm="SHA" fileext=".sha1"/>
<checksum file="mylib-1.2.3.pom" algorithm="SHA" fileext=".sha1"/>
</target>
</project>
4、生成 mylib-1.2.3.jar.sha1 和 mylib-1.2.3.pom.sha1 文件
ant build.xml
【使用版本控制】
提交:mvn scm:checkin -Dmessage="Message"
檢出:mvn scm:checkout
更新:mvn scm:update
【UTF8編碼編譯失敗】
editplus打開文件:文檔->參數設置->文件->UTF-8簽名->總是移除簽名->確定->另存為UTF8文件

一些問題:
1、UTF8編碼的文件安裝成archetype項目后,再照此模板生成新項目會有些中文字符不識別,不知道如何改
2、UTF8編碼的文件安裝成archetype項目后,如果同時安裝了gif圖片,再照此模板生成新項目時gif文件損壞,但在安裝在rep中的模板項目中的gif文件是好的。

草原上的駱駝 2009-02-14 11:52 發表評論
]]>
MVN 報錯http://www.aygfsteel.com/nkjava/archive/2009/02/12/254444.html草原上的駱駝草原上的駱駝Thu, 12 Feb 2009 13:04:00 GMThttp://www.aygfsteel.com/nkjava/archive/2009/02/12/254444.htmlhttp://www.aygfsteel.com/nkjava/comments/254444.htmlhttp://www.aygfsteel.com/nkjava/archive/2009/02/12/254444.html#Feedback0http://www.aygfsteel.com/nkjava/comments/commentRss/254444.htmlhttp://www.aygfsteel.com/nkjava/services/trackbacks/254444.html[INFO] ------------------------------------------------------------------------

[ERROR] BUILD ERROR

[INFO] ------------------------------------------------------------------------

[INFO] Failed to resolve artifact.



Missing:

----------

1) javax.jms:jms:jar:1.1



Try downloading the file manually from:

http://java.sun.com/products/jms/docs.html



Then, install it using the command:

mvn install:install-file -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar -Dfile=/path/to/file



Alternatively, if you host your own repository you can deploy the file there:

mvn deploy:deploy-file -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]



Path to dependency:

1) example.helloworld:WicketHelloWorld:war:0.0.1-SNAPSHOT

2) log4j:log4j:jar:1.2.15

3) javax.jms:jms:jar:1.1



2) com.sun.jdmk:jmxtools:jar:1.2.1



Try downloading the file manually from:

http://java.sun.com/products/JavaManagement/download.html



Then, install it using the command:

mvn install:install-file -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file



Alternatively, if you host your own repository you can deploy the file there:

mvn deploy:deploy-file -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -Drepositor

yId=[id]



Path to dependency:

1) example.helloworld:WicketHelloWorld:war:0.0.1-SNAPSHOT

2) log4j:log4j:jar:1.2.15

3) com.sun.jdmk:jmxtools:jar:1.2.1



3) com.sun.jmx:jmxri:jar:1.2.1



Try downloading the file manually from the project website.



Then, install it using the command:

mvn install:install-file -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file



Alternatively, if you host your own repository you can deploy the file there:

mvn deploy:deploy-file -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=

[id]



Path to dependency:

1) example.helloworld:WicketHelloWorld:war:0.0.1-SNAPSHOT

2) log4j:log4j:jar:1.2.15

3) com.sun.jmx:jmxri:jar:1.2.1



----------

3 required artifacts are missing.



這一般是由log4j的版本問題引起的,我之前的配置如下:

        <dependency>

    <groupId>log4j</groupId>

    <artifactId>log4j</artifactId>

    <version>1.2.5</version>

</dependency>

就會引起上面的錯誤,改成如下的寫法即可

        <dependency>

    <groupId>log4j</groupId>

    <artifactId>log4j</artifactId>

    <version>[1.2,)</version>

</dependency>





草原上的駱駝 2009-02-12 21:04 發表評論
]]>
maven 構建hibernate項目時缺少jta包解決辦法http://www.aygfsteel.com/nkjava/archive/2009/02/12/254438.html草原上的駱駝草原上的駱駝Thu, 12 Feb 2009 12:24:00 GMThttp://www.aygfsteel.com/nkjava/archive/2009/02/12/254438.htmlhttp://www.aygfsteel.com/nkjava/comments/254438.htmlhttp://www.aygfsteel.com/nkjava/archive/2009/02/12/254438.html#Feedback0http://www.aygfsteel.com/nkjava/comments/commentRss/254438.htmlhttp://www.aygfsteel.com/nkjava/services/trackbacks/254438.htmlMaven missing JTA artifact

When you get in Maven:

Missing indirectly referenced artifact javax.transaction:jta:jar:1.0.1B:compile

the solution is to download “Class Files 1.0.1B” from http://java.sun.com/javaee/technologies/jta/index.jsp and then do:

mvn install:install-file -Dfile=./jta-1_0_1B-classes.zip 

-DgroupId=javax.transaction -DartifactId=jta

-Dversion=1.0.1B -Dpackaging=jar



草原上的駱駝 2009-02-12 20:24 發表評論
]]>
主站蜘蛛池模板: 新干县| 连州市| 虞城县| 萨迦县| 渝中区| 泽普县| 嵊州市| 万源市| 陕西省| 洞头县| 乐清市| 西林县| 德钦县| 新龙县| 黔南| 克什克腾旗| 凤山县| 通江县| 湛江市| 枞阳县| 塔河县| 通州区| 河间市| 夹江县| 义马市| 诸暨市| 会宁县| 潮安县| 新绛县| 苗栗县| 蒲江县| 厦门市| 韩城市| 繁昌县| 平远县| 定边县| 四子王旗| 湛江市| 银川市| 博客| 安泽县|