Anasayfa > Programlama > How to create spring-based executable jar with maven?

How to create spring-based executable jar with maven?

Very likely what has happened is the files which provides meta data to Spring about the location of the custom namespace handlers(spring.schema, spring.handlers) have ended up overwriting each other when you created the big(uber) jar.

To clarify this a little more, if you are using context name space say – context:property-placeholder-configurer, the information about how to parse this namespace is using a spring.handlers file in spring-context.jar!:/META-INF/spring.handlers file, a similar file is present in other spring jar files for other custom namespaces support. Now, when you create the Uber jar, since the location of the handler file is exactly the same, one spring.handler file will end up overwriting the others, and you see the error that you are seeing. Some potential fixes are described here, where some alternate ways of creating the executable jar is suggested:

add the following configuration after

<plugin>
  <executions>
    <execution>
      <configuration>
        <transformers>

so that the contents of the .schema files from all the jars get appended together.

<configuration>
  <transformers>
    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
      <resource>META-INF/spring.handlers</resource>
    </transformer>
    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
      <resource>META-INF/spring.schemas</resource>
    </transformer>
  </transformers>
</configuration>
Kategoriler:Programlama
  1. Henüz yorum yapılmamış.
  1. No trackbacks yet.

Bir Cevap Yazın

Aşağıya bilgilerinizi girin veya oturum açmak için bir simgeye tıklayın:

WordPress.com Logosu

WordPress.com hesabınızı kullanarak yorum yapıyorsunuz. Log Out / Değiştir )

Twitter resmi

Twitter hesabınızı kullanarak yorum yapıyorsunuz. Log Out / Değiştir )

Facebook fotoğrafı

Facebook hesabınızı kullanarak yorum yapıyorsunuz. Log Out / Değiştir )

Google+ fotoğrafı

Google+ hesabınızı kullanarak yorum yapıyorsunuz. Log Out / Değiştir )

Connecting to %s

%d blogcu bunu beğendi: