Im using maven and weld. I have created beans.xml but while im starting app (java application) i have error like this:
my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.kamczi</groupId>
<artifactId>maven-di</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se</artifactId>
<version>2.3.2.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
my error: Exception in thread "main" java.lang.IllegalStateException: WELD-ENV-000016: Missing beans.xml file in META-INF at org.jboss.weld.environment.se.Weld.initialize(Weld.java:539) at com.kamczi.Main.main(Main.java:10)
I would say the problem here is that you have your beans.xml
under src/test/...
while Weld presumes there is one in src/main/...
.
If it is testing you are after, then I suggest you either use a synthetic bean archive in case you are in SE or, if in EE, then you can leverage Shrinkwrap and Arquillian to create a deployment with whatever beans.xml
you want.