我有一个使用weld se 的小cli 应用程序,如果我从eclipse 中运行该应用程序,它可以正常工作(使用weld se 的主要方法:org.jboss.weld.environment.se.StartMain)
问题是我无法创建一个可以工作的可执行 jar。目前我使用 maven-assembly-plugin:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.jboss.weld.environment.se.StartMain</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-my-jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
我还尝试了阴影插件:
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
但在所有情况下,我都会遇到同样多的错误:
Nov 03, 2015 5:50:21 PM org.jboss.weld.bootstrap.MissingDependenciesRegistry handleResourceLoadingException
INFO: WELD-000119: Not generating any bean definitions from org.jboss.weld.servlet.api.helpers.ForwardingServletListener because of underlying class loading error: Type javax.servlet.ServletContextListener not found. If this is unexpected, enable DEBUG logging to see the full error.
... many of this kind with different classes
Exception in thread "main" org.jboss.weld.exceptions.DeploymentException: java.lang.InternalError: Enclosing method not found
...
Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.InternalError: Enclosing method not found
...
Caused by: java.lang.InternalError: Enclosing method not found
...
同时我也尝试添加
<scan>
<exclude name="org.jboss.weld.**" />
</scan>
按照这里的建议到我的 beans.xml 。没变...