Вопрос по eclipse, java – Как создать военные файлы

90

Error: User Rate Limit Exceeded

Ваш Ответ

13   ответов
2

Error: User Rate Limit Exceeded

STEPS:

  1. Enable "Project Archives" support; this might depend on your project (I used it on Java EE/Web project). Right-click project root directory; Configure -> Add Project Archives Support.

  2. Go and create a new archive in the "Project Archives" top dir. You have only jar option, but name you archive *.war.

  3. Configure Fileset-s, i.e what files to be included. Typical is to configure two filesets similar how the Web Deployment Assembly (project property) is configured.

    • copy /WebContent to /
    • copy /build/classes to WEB-INF/classes (create this fileset after you define the WEB-INF/classes directory in the archive)
  4. You might need to tweek the fileset exclude property depending where you placed some of the config files or you might need more filesets, but the idea is that once you configured this you don't need to change it.

  5. Build the archive manually or publish directly to server; but is also automatically built for you by Eclipse

0

Error: User Rate Limit Exceeded

#!/bin/sh

UTILITY=$(basename $0)

if [ -z "$1" ] ; then
    echo "usage: $UTILITY [-s] <web-app-directory>..."
    echo "       -s ..... With source"
    exit 1
fi

if [ "$1" == "-s" ] ; then
    WITH_SOURCE=1
    shift
fi

while [ ! -z "$1" ] ; do
    WEB_APP_DIR=$1

    shift

    if [ ! -d $WEB_APP_DIR ] ; then
        echo "\"$WEB_APP_DIR\" is not a directory"
        continue
    fi

    if [ ! -d $WEB_APP_DIR/WebContent ] ; then
        echo "\"$WEB_APP_DIR\" is not a Web Application directory"
        continue
    fi

    TMP_DIR=/dev/shm/${WEB_APP_DIR}.$$.tmp
    WAR_FILE=/dev/shm/${WEB_APP_DIR}.war

    mkdir $TMP_DIR

    pushd $WEB_APP_DIR > /dev/null
    cp -r WebContent/* $TMP_DIR
    cp -r build/* $TMP_DIR/WEB-INF
    [ ! -z "$WITH_SOURCE" ] && cp -r src/* $TMP_DIR/WEB-INF/classes
    cd $TMP_DIR > /dev/null
    [ -e $WAR_FILE ] && rm -f $WAR_FILE
    jar cf $WAR_FILE .
    ls -lsF $WAR_FILE
    popd > /dev/null

    rm -rf $TMP_DIR
done
4

Error: User Rate Limit ExceededError: User Rate Limit Exceeded

12

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

  1. Download and install Maven
  2. Go the command line run: mvn archetype:generate
  3. Follow the prompted steps - choosing the simple java web project (18) and a suitable name.
  4. When it is finished run: mvn eclipse:eclipse
  5. Start Eclipse. Choose File -> Import -> Existing project. Select the directory where you ran the mvn goals.
  6. That's it you should now have a very good start to a war project in eclipse
  7. You can create the war itself by running mvn package or deploy it by setting up a server in eclipse and simply adding adding the project to the server.

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

-2

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

  1. run clean comand in eclips

  2. run 'prod war' fowllowed by project name.

  3. Check the log file and find the same .war file in directory of workbench with same date.

94

Error: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit ExceededError: User Rate Limit Exceeded

<target name="default" depends="setup,compile,buildwar,deploy"></target>

Error: User Rate Limit Exceeded

Preconditions

Error: User Rate Limit Exceeded

  • ${basedir}/src: Java files, properties, XML config files
  • ${basedir}/web: Your JSP files
  • ${basedir}/web/lib: Any JARs required at runtime
  • ${basedir}/web/META-INF: Your manifest
  • ${basedir}/web/WEB-INF: Your web.xml files

Set up

Error: User Rate Limit ExceededsetupError: User Rate Limit Exceeded

<target name="setup">
    <mkdir dir="dist" />
    <echo>Copying web into dist</echo>
    <copydir dest="dist/web" src="web" />
    <copydir dest="dist/web/WEB-INF/lib" src="${basedir}/../web/WEB-INF/lib" />
</target>

Compile

Error: User Rate Limit ExceededsrcError: User Rate Limit Exceeded

<target name="compile">
    <delete dir="${dist.dir}/web/WEB-INF/classes" />
    <mkdir dir="${dist.dir}/web/WEB-INF/classes" />
    <javac destdir="${dist.dir}/web/WEB-INF/classes" srcdir="src">
        <classpath>
            <fileset dir="${basedir}/../web/WEB-INF/lib">
                  <include name="*" />
            </fileset>
        </classpath>
    </javac>
    <copy todir="${dist.dir}/web/WEB-INF/classes">
        <fileset dir="src">
            <include name="**/*.properties" />
            <include name="**/*.xml" />
        </fileset>
    </copy>
</target>

Build WAR

Error: User Rate Limit Exceeded

<target name="buildwar">
    <war basedir="${basedir}/dist/web" destfile="My.war"
     webxml="${basedir}/dist/web/WEB-INF/web.xml">
        <exclude name="WEB-INF/**" />
        <webinf dir="${basedir}/dist/web/WEB-INF/">
            <include name="**/*.jar" />
        </webinf>
    </war>
</target>

Deploy

Error: User Rate Limit Exceeded

<target name="deploy">
    <copy file="My.war" todir="${tomcat.deploydir}" />
</target>

Click and go!

Error: User Rate Limit ExceededdefaultError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

В цели войны нет необходимости & lt; exclude name = & quot; WEB-INF / ** & quot; / & GT; & APOS ;. Вы создали файлы * .class в этой папке, и исключение их не работает. Удалите эту исключающую линию из цели войны, которую она работает.
ну, я хочу развернуть его на Tomcat. Как мне сменить таргер?
Этот ответ излишне сложен.
Error: User Rate Limit Exceeded
Не могли бы вы уточнить? Пока $ {tomcat.deploydir} указывает на каталог развертывания контекста Tomcat, он должен это делать. Нет?
3

Error: User Rate Limit Exceeded

<property name="WEB-INF" value="${basedir}/WebRoot/WEB-INF" />
<property name="OUT" value="${basedir}/out" />
<property name="WAR_FILE_NAME" value="mywebapplication.war" />
<property name="TEMP" value="${basedir}/temp" />

<target name="help">
    <echo>
        --------------------------------------------------
        compile - Compile
        archive - Generate WAR file
        --------------------------------------------------
    </echo>
</target>

<target name="init">
    <delete dir="${WEB-INF}/classes" />
    <mkdir dir="${WEB-INF}/classes" />
</target>

<target name="compile" depends="init">
    <javac srcdir="${basedir}/src" 
                destdir="${WEB-INF}/classes" 
                classpathref="libs">
    </javac>
</target>

<target name="archive" depends="compile">
    <delete dir="${OUT}" />
    <mkdir dir="${OUT}" />
    <delete dir="${TEMP}" />
    <mkdir dir="${TEMP}" />
    <copy todir="${TEMP}" >
        <fileset dir="${basedir}/WebRoot">
        </fileset>
    </copy>
    <move file="${TEMP}/log4j.properties" 
                    todir="${TEMP}/WEB-INF/classes" />
    <war destfile="${OUT}/${WAR_FILE_NAME}" 
                    basedir="${TEMP}" 
                    compress="true" 
                    webxml="${TEMP}/WEB-INF/web.xml" />
    <delete dir="${TEMP}" />
</target>

<path id="libs">
    <fileset includes="*.jar" dir="${WEB-INF}/lib" />
</path>

0

Error: User Rate Limit Exceeded

<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="default">    
    <target name="default">
        <war destfile="target/MyApplication.war" webxml="web/WEB-INF/web.xml">
            <fileset dir="src/main/java" />
            <fileset dir="web/WEB-INF/views" />
            <lib dir="web/WEB-INF/lib"/>
            <classes dir="target/classes" />
        </war>
        <eclipse.refreshLocal resource="MyApplication/target" depth="infinite"/>
    </target>
</project>
22

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceededmaven eclipse:eclipseError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1-alpha-2</version>
    <configuration>
        <outputDirectory>${project.build.directory}/tmp/</outputDirectory>
        <workDirectory>${project.build.directory}/tmp/war/work</workDirectory>
        <webappDirectory>${project.build.webappDirectory}</webappDirectory>
        <cacheFile>${project.build.directory}/tmp/war/work/webapp-cache.xml</cacheFile>
        <nonFilteredFileExtensions>
            <nonFilteredFileExtension>pdf</nonFilteredFileExtension>
            <nonFilteredFileExtension>png</nonFilteredFileExtension>
            <nonFilteredFileExtension>gif</nonFilteredFileExtension>
            <nonFilteredFileExtension>jsp</nonFilteredFileExtension>
        </nonFilteredFileExtensions>
        <webResources>
            <resource>
                <directory>src/main/webapp/</directory>
                <targetPath>WEB-INF</targetPath>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </webResources>
        <warName>Application</warName>
    </configuration>
</plugin>
Мэйвен - старший брат Муравья? Они вообще не связаны ....: p
Мне это нравится =) Я работаю в качестве CM над довольно большим проектом, и я ценю, что основная работа по настройке проекта была сделана для меня. Кроме того, поддержка плагинов замечательно. Возможность создать и запустить многомодульный проект с WAR-плагином с помощью Surefire и CheckStyle за пять минут - это удовольствие. Муравей, хотя и более открытый и, возможно, более мощный, по сравнению с ним доставляет массу хлопот. В любом случае, Maven является подмножеством Ant, поэтому, если вам нужно выполнить какие-либо сценарии там, добро пожаловать.
Error: User Rate Limit Exceeded
14

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

1

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

jar -cvf projectname.war *

Error: User Rate Limit Exceeded

2

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

apply plugin: 'war'

Error: User Rate Limit Exceeded

./gradlew war

Error: User Rate Limit Exceeded

37

Error: User Rate Limit Exceeded

другое решение вместо создания ant-файла - перейти в папку, которую вы хотите обернуть в WAR-файл, и выполнить эту команду & quot; jar -cvf name.war * & quot; ,
Спасибо за это, намного проще, чем конфигурировать Maven или Ant (когда это необязательно).
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded

Похожие вопросы