相关疑难解决方法(0)

想法避免spring.handlers/spring.schemas在单个jar中合并多个spring依赖项时会被覆盖

我得到了错误Unable to locate NamespaceHandler when using context:annotation-config运行(java -jar)一个由maven-assembly-plugin组装并包含我的项目及其所有依赖项的jar.

正如其他人在forum.springsource.org 线程(消息#7/8)上正确发现的那样,问题出现是因为文件META-INF/spring.handlersMETA-INF/spring.schemas存在于不同的jar中,当maven-assembly-plugin在单个文件中重新打包jar时会被覆盖.

查看两个spring - *.jar文件的内容,您可以看到文件位于相对于类路径的相同位置

$ jar tf spring-oxm-3.0.3.RELEASE.jar
META-INF/spring.handlers
META-INF/spring.schemas
org/springframework/oxm/GenericMarshaller.class
...

$ jar tf spring-context-3.0.3.RELEASE.jar
META-INF/spring.handlers
META-INF/spring.schemas
org/springframework/context/ApplicationContext.class
Run Code Online (Sandbox Code Playgroud)

是不是可以将META-INF文件夹放在特定的包中?如果是这样,我建议的想法(希望它是适用的)是将META-INF/spring.shemasMETA-INF/spring.handlers文件放在他们引用的包下面.

$ jar tf spring-oxm-3.0.3.RELEASE.jar
org/springframework/oxm/META-INF/spring.schemas
org/springframework/oxm/META-INF/spring.handlers
org/springframework/oxm/GenericMarshaller.class
...

$ jar tf spring-context-3.0.3.RELEASE.jar
org/springframework/context/META-INF/spring.handlers
org/springframework/context/META-INF/spring.schemas
org/springframework/context/ApplicationContext.class
Run Code Online (Sandbox Code Playgroud)

这样,在单个jar中合并时它们不会发生冲突.你怎么看待这件事?

spring meta-inf maven-assembly-plugin

35
推荐指数
1
解决办法
2万
查看次数

如何在Netbeans项目中包含外部jar

当我运行"clean and build"时,.jar只有当lib文件夹位于.jar文件的同一文件夹时,才会运行正在创建的文件.

因此,如果我将jar文件移动到桌面并将lib文件夹保留在文件dist夹中,那么jar文件将给我一个例外.

我该如何处理这个问题?

java netbeans jar

23
推荐指数
4
解决办法
7万
查看次数

用maven构建完整的应用程序文件夹

大多数java独立应用程序在部署到生产环境后最终都会出现在这样的文件夹中.

myapp  
|->lib (here lay all dependencies)  
|->config (here lay all the config-files) 
|->myapp.bat  
|->myapp.sh  
Run Code Online (Sandbox Code Playgroud)

我想知道maven中是否有任何内容可以为我构建并将其放在tar.gz中.

Java:如何构建基于Maven的项目的独立发行版?别无选择.我不想让maven打开我需要的所有罐子.

java build maven

4
推荐指数
1
解决办法
373
查看次数

标签 统计

java ×2

build ×1

jar ×1

maven ×1

maven-assembly-plugin ×1

meta-inf ×1

netbeans ×1

spring ×1