国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
How to: installers, Jetty, postgresql with maven2
I had the following requirements:
  1. create an installer for my application;
  2. the application is based on web-technologies, so the installer must ship an application server and automatically install my webapp into it;
  3. the application requires a dbms (Postgres was the choice, a similar process will work also with Hsqldb), so the installer must ship it, possibly automatically installing it on the target machine;
  4. my application is build through maven, so the creation of the installer should be integrated in the whole build chain;
  5. the installer must be easy to use, even for monkey-brained users

I looked for a standardized way to do all this: although Maven team has planned some native support for this kind of problems see this,at the moment there are only partial solutions from non-mainstreamexternal plugins. I‘ll go through the entire process, and at the end,some more alternatives are proposed.
The solution I ended up involves the following steps:
  1. install Postgres installer into a maven repository: this is an easy step, because it only requires to zip the target file (i did it manually, but if you really you can let maven do it for you...which I don‘t suggest at all), and install and deploy it into your local repository. So I downloaded the file from the msi postgres windows and issued this:
    mvn  -Dfile=postgres-installer.zip \n 
    -DgeneratePom=true \n
    -DgroupId=postgres \n
    -DartifactId=postgres-installer \n
    -Dversion=VERSION-NUMBER -DrepositoryId=SERVER \n
    -Durl=scp://path/to/your/maven2/repository \n
    -Dpackaging=zip \n
    deploy:deploy-file
  2. install an application server into a maven repository: do the same for your application server of choice: mine was jetty, because I use it heavily during development, and because its installint procedure is a matter of unzipping and copying its files somewhere (which other application servers allow this ?):
    mvn  -Dfile=jetty-6.0.2.zip \n 
    -DgeneratePom=true \n
    -DgroupId=jetty \n
    -DartifactId=jetty \n
    -Dversion=VERSION-NUMBER -DrepositoryId=SERVER \n
    -Durl=scp://path/to/your/maven2/repository \n
    -Dpackaging=zip \n
    deploy:deploy-file
  3. install the application war into a maven repository: this is maybe the easiest step: given your webapp, which should have a packaging element of value war, it is only a matter of doing a mvn deploy from the root of your project, given that you‘ve provided the correct distribution management informations in the pom; i won‘t comment further on this;
  4. install locally the izpack-maven-plugin: this mojo is still a proposal, so you can‘t simply declare it in your pom: you need to install by your self. Let‘s get it from Jira and from the root directory:
    mvn install
  5. use the maven-dependency-plugin properly:this is the interesting part. It requires just a little bit of knowledge of the goals available through this plugin and to combine them propertly. here is the result:
    <plugins>
    <plugin>
    <groupId>org.codehaus.mojo</groupId>

    <artifactId>dependency-maven-plugin</artifactId>
    <executions>
    <!-- unzip jetty & postgresql -->
    <execution>
    <id>unzip-jetty-postgresql</id>

    <phase>process-resources</phase>
    <goals>
    <goal>unpack</goal>
    </goals>
    <configuration>

    <artifactItems>
    <artifactItem>
    <groupId>jetty</groupId>
    <artifactId>jetty-standalone</artifactId>
    <version>6.0.2</version>

    <type>zip</type>
    <outputDirectory>
    ${project.build.directory}/${project.build.finalName}/
    </outputDirectory>
    </artifactItem>
    <artifactItem>

    <groupId>postgresql</groupId>
    <artifactId>postgresql-installer-win</artifactId>
    <version>8.1.5</version>
    <type>zip</type>

    <outputDirectory>
    ${project.build.directory}/${project.build.finalName}/postgresql/
    </outputDirectory>
    </artifactItem>
    </artifactItems>
    </configuration>
    </execution>

    <execution>
    <id>copy-webapp-war</id>
    <phase>process-resources</phase>
    <goals>

    <goal>copy</goal>
    </goals>
    <configuration>
    <stripVersion>true</stripVersion>
    <artifactItems>

    <artifactItem>
    <groupId>your-groupid</groupId>
    <artifactId>your-webapp</artifactId>
    <version>1.0-SNAPSHOT</version>

    <type>war</type>
    <outputDirectory>
    ${project.build.directory}/${project.build.finalName}/jetty-6.0.2/webapps/
    </outputDirectory>
    </artifactItem>

    </artifactItems>
    </configuration>
    </execution>
    </executions>
    </plugin>

    </plugins>
  6. configure the izpack plugin to run in the package phase: this is very easy, and goes like this:
    <plugin>

    <groupId>org.codehaus.mojo</groupId>
    <artifactId>izpack-maven-plugin</artifactId>
    <version>1.0-SNAPSHOT</version>
    <executions>

    <execution>
    <phase>package</phase>
    <goals>
    <goal>izpack</goal>
    </goals>

    </execution>
    </executions>
    </plugin>

Having this pom configuration, it is enough to issue mvn package to find in our target/directory a beautiful executable jar file, which will install ourapplication, togheter with postgres and application in the targetmachine.
Ah, sure: you need a working izpack.xml file in src/izpack/directory to let the maven plugin works correctly. In a future blogentry, I‘ll go on with this example showing how to write such file.
One more thing: very recently, Vincent Massol proposed a new support(the Packager API) within the core api of cargo plugin, which shouldgreetly simplify this process. Stay tuned!
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
eclipse中利用jetty進行Maven web項目開發(fā)調(diào)試
maven jetty eclipse run stop debug 調(diào)試java web項目
2. 一個簡單的Web應(yīng)用
Jetty/Feature/Jetty Maven Plugin
Maven Jetty Plugin 配置指南(翻譯)
Maven提高篇系列之二
更多類似文章 >>
生活服務(wù)
分享 收藏 導長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服