2016-12-20 14 views
-1

私はcommon_module.warという戦争のパッケージである共通のモジュールを実装しました。別のテストアプリケーションでこのcommon_module.warを使用する必要があります。私のlocal eclipseでは、common_module.warをテストアプリケーションへの依存として含めると、すべてのjsps & javaクラスのcommon_module.warにテストアプリケーションでアクセスできます。ここまでは順調ですね。Maven-dependency war unpack

問題はサーバーに展開するためです。 common_module.warを私の会社のartifactoryフォルダにアップロードしました。そして、そのパスをリポジトリパスに埋め込んだ。現在、テストアプリケーションはcommon_module.warのjspにアクセスできません。

私はここで間違っていますか?

エラーです - 私はテストアプリケーションで共通モジュールのJSPを含んでいます。そこに私は赤いマークのエラーjspが見つかりませんが見つかりました。

<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/xsd/maven-4.0.0.xsd"> 
<modelVersion>4.0.0</modelVersion> 
    <groupId>test_group_id</groupId> 
    <artifactId>test_artifact</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>war</packaging> 
    <name>test</name> 
    <description>test</description> 
<repositories> 
     <repository> 
      <id>central</id> 
      <name>Maven Repository Switchboard</name> 
      <layout>default</layout> 
      <url>http://repo1.maven.org/maven2</url> 
      <snapshots> 
       <enabled>false</enabled> 
      </snapshots> 
     </repository> 
     <repository> 
      <id>my_company_name</id> 
      <url>path_to_my_company_artifactory</url> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
      <releases> 
       <enabled>true</enabled> 
      </releases> 
     </repository> 
    </repositories> 
    <dependencies> 
    <dependency> 
      <groupId>common_module_group_id</groupId> 
       <artifactId>common_module_artifact</artifactId> 
      <version>0.0.1-SNAPSHOT</version> 
      <type>war</type> 
     <scope>runtime</scope> 
     </dependency> 
     </dependencies> 
    <plugins> 

      <plugin> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.3</version> 
       <configuration> 
        <outputDirectory>${project.build.directory}/../package/dependencies/jbossews/webapps</outputDirectory> 
        <warSourceDirectory>/src/main/webapp</warSourceDirectory> 
         <webXml>src\main\webapp\WEB-INF\web.xml</webXml> 
        <attachClasses>true</attachClasses> 
       <classesClassifier>classes</classesClassifier> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-assembly-plugin</artifactId> 
       <version>2.4</version> 
       <executions> 
        <execution> 
         <phase>package</phase> 
         <goals> 
          <goal>single</goal> 
         </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <appendAssemblyId>false</appendAssemblyId> 
        <descriptors> 
         <descriptor>assembly.xml</descriptor> 
        </descriptors> 
       </configuration> 
      </plugin> 
      <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.3.2</version> 
      <configuration> 
       <source>1.7</source> 
       <target>1.7</target> 
      </configuration> 
     </plugin> 
     </plugins> 
</project> 
+0

アーティファクトが正しく展開されていますか?これをサーバーログで確認できますか? –

+0

いいえアーチファクトがうまく展開されました。 – user1457957

+0

あなたのポンとエラー情報を投稿してください。 –

答えて

0

web-fragmentを実装しようとしているようです。これは、WebアプリケーションのWEB-INF/libディレクトリに含めることができるJARファイル(WARファイルではない)です。これには、JSPを含むWARファイルと同じコンポーネントが含まれている場合があります。それはちょうど異なってパッケージ化されています。

jarファイルにはMETA-INF/web-fragment.xmlファイルを含める必要があり、JSPはMETA-INF/resourcesディレクトリにパッケージ化する必要があります。サーブレットコンテナは、WARファイルのルートにあるかのように、このディレクトリ内のJSPファイルを扱います。 web-fragment.xmlは基本的に通常のweb.xmlファイルのサブセットです。

これはServlet 3.0+の機能です。

Java Servlet Specification 3.0/3.1の§8.2および§10.5を参照してください。

+0

で解決しましたが、私はオーバーレイフィーチャーでこれを達成できませんか? – user1457957

+0

基本的には、私はTestプロジェクトのjspsとjavaクラスの共通moudleにアクセスしたいと思っています。私のローカルオーバーレイ機能では、機能しており、アクセスすることができます。しかし、私は共有モジュールのwarファイルをサーバーにアップロードするときにのみ問題 – user1457957

0

戦争オーバーレイ機能は、この問題を解決するのに役立ちました。今はうまくいきます。