2016-04-07 20 views
1

私の現在のプロジェクトでは、私はスプリングブートを使用しています。すべての依存関係を除外します。スプリングブートMavenプラグイン - すべての依存関係を除外

<plugin> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-maven-plugin</artifactId> 
    <version>1.3.3.RELEASE</version> 
    <executions> 
     <execution> 
      <goals> 
       <goal>repackage</goal> 
      </goals> 
     </execution> 
    </executions> 
    <configuration> 
     <mainClass>a.b.testClass</mainClass> 
     <layout>ZIP</layout> 
      <excludeArtifactIds>*</excludeArtifactIds> 
    </configuration> 
</plugin> 
+0

これを行うと動作しません。 – OrangeDog

+0

なぜそれをしたいのですか?それは基本的にSpring Bootを使用する目的に勝るものです。 –

答えて

-1

これを試すことができます。動作しているようです

<configuration> 
     <excludes> 
     <exclude> 
      <groupId>*</groupId> 
      <artifactId>*</artifactId> 
     </exclude> 
     </excludes> 
    </configuration> 
+2

その動作していない私はすでにテストしている –

2

醜いソリューションを置くことで、既存のないアーティファクトに含まれていますバージョン1.3.3の

<configuration> 
    <layout>ZIP</layout> 
    <includes> 
     <include> 
      <groupId>abc</groupId> 
      <artifactId>abc</artifactId> 
     </include> 
    </includes> 
</configuration> 

機能しますが、それは次のバージョンでは変更されません保証はありません。 http://docs.spring.io/spring-boot/docs/current/reference/html/howto-build.html#howto-build-an-executable-archive-with-ant あなたが達人に適用する必要があるステップのリストを与えることができます。

それとも、あなたはすべてのものを自分でパッケージ化することができ、アリのための命令があります。だから、:

  1. はマニフェストにメインクラスとスタートクラスを含める:

    <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-jar-plugin</artifactId> 
    
        <configuration> 
         <archive> 
          <manifest> 
           <mainClass>org.springframework.boot.loader.PropertiesLauncher</mainClass> 
          </manifest> 
          <manifestEntries> 
           <Start-Class>your.package.YourMainClass</Start-Class> 
          </manifestEntries> 
         </archive> 
        </configuration> 
    </plugin> 
    
  2. スキップをlibディレクトリに依存関係を追加します。

  3. はルートに春のブートローダークラスを追加します。まず、依存関係を必要とする:

    <dependency> 
        <groupId>org.springframework.boot</groupId> 
        <artifactId>spring-boot-loader</artifactId> 
        <version>1.3.3.RELEASE</version> 
    </dependency> 
    

    次に、あなたがそれを解凍する必要があります。

    <plugin> 
        <artifactId>maven-dependency-plugin</artifactId> 
    
        <executions> 
         <execution> 
          <phase>process-sources</phase> 
    
          <goals> 
           <goal>unpack</goal> 
          </goals> 
    
          <configuration> 
           <artifactItems> 
            <artifactItem> 
             <groupId>org.springframework.boot</groupId> 
             <artifactId>spring-boot-loader</artifactId> 
             <outputDirectory>${project.build.directory}/classes</outputDirectory> 
            </artifactItem> 
           </artifactItems> 
          </configuration> 
         </execution> 
        </executions> 
    </plugin> 
    

    ローダークラスを置くためのより良い方法があるかもしれませんこれは私のプロジェクトではうまくいきます。

関連する問題