not resolved, but avoid the problem:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <version>3.1.0</version>
  <executions>
    <execution>
      <id>default-jar</id>
      <phase>package</phase>
    </execution>
  </executions>
  <configuration>
    <archive>
      <manifest>
        <classpathLayoutType>repository</classpathLayoutType>
        <addClasspath>true</addClasspath>
        <!--must reference local repository jars, otherwise when run
"mvn install", will have classpath problem-->
        <classpathPrefix>/${settings.localRepository}/</classpathPrefix>
        <mainClass>${it.main}</mainClass>
      </manifest>
      <manifestEntries>
        <Class-Path>. ..</Class-Path>
      </manifestEntries>
    </archive>
  </configuration>
</plugin>



2018-07-30 15:58 GMT+08:00 wjm wjm <zzz...@gmail.com>:

> must run "mvn install" in parent level, that will cause problem.
>
> eg:
> integration tests
>   springmvc-tests
>     springmvc-tests-general-with-springboot
>
> run in " integration tests" or " springmvc-tests", have problems.
> but run in " springmvc-tests-general-with-springboot", no problem.
>
> 2018-07-29 2:41 GMT+08:00 wjm wjm <zzz...@gmail.com>:
>
>> infact classpath data in MANIFEST.MF is no problem, "java -jar xx.jar" is
>> no problem.
>> just only classpath for "mvn install" have problem, exclude is not
>> a solution for this.
>>
>> 2018-07-28 14:40 GMT+08:00 Willem Jiang <willem.ji...@gmail.com>:
>>
>>> It looks like the plugin add  all the m2 depedencies into the classpath.
>>> Can you exclude them[1] in the maven jar plugin ?
>>>
>>> [1]
>>> https://maven.apache.org/plugins/maven-jar-plugin/examples/i
>>> nclude-exclude.html
>>>
>>>
>>> Willem Jiang
>>>
>>> Twitter: willemjiang
>>> Weibo: 姜宁willem
>>>
>>> On Sat, Jul 28, 2018 at 9:33 AM, wjm wjm <zzz...@gmail.com> wrote:
>>>
>>> > 1.there is no problem run unit test, and start spring
>>> applicationContext,
>>> > by "mvn install"
>>> > 2.add maven-jar-plugin in pom, set outputDirectory, and run "mvn
>>> install"
>>> > again
>>> > spring will load duplicated libraries in different directory, that
>>> cause
>>> > spring start failed.
>>> > (target/lib is my " outputDirectory ")
>>> >
>>> > Loading XML bean definitions from URL
>>> > [jar:file:/D:/work/git/local-servicecomb/integration-tests/
>>> > target/lib/java-chassis-core-1.1.0-SNAPSHOT.jar!/META-INF/
>>> > spring/cse.bean.xml]
>>> > Loading XML bean definitions from URL
>>> > [jar:file:/C:/Users/Administrator/.m2/repository/
>>> > org/apache/servicecomb/java-chassis-core/1.1.0-SNAPSHOT/
>>> > java-chassis-core-1.1.0-SNAPSHOT.jar!/META-INF/spring/cse.bean.xml]
>>> >
>>> > can anybody help me to avoid this problem?
>>> > thanks.
>>> >
>>>
>>
>>
>

Reply via email to