转载

WildFly Swarm Alpha2 发布

6月14日上海 OSC 源创会开始报名,送机械键盘和开源无码内裤

WildFly Swarm Alpha2 发布,此版本包括一些改进和修复。此版本解决了所有 Windows 的 issues。

相比 Alpha1 修改了一些插件的使用方式,用户需要更新一些应用:

  • 从 wildfly-swarm-plugin 移除了 execution phase

  • 把 wildfly-swarm-plugin 目标从 create 修改为 package

  • 从所有 pom.xml 的 WildFly Swarm 依赖中移除了 provided scope

Weld 和 JAX-RS

当你使用 Weld 和 JAX-RS 时,有一些模块会失效,所以创建了新的 fraction 来弥补这个连接。添加以下依赖;

<dependency>   <groupId>org.wildfly.swarm</groupId>   <artifactId>wildfly-swarm-weld-jaxrs</artifactId>   <version>${version.wildfly-swarm}</version> </dependency>

JPA

此版本初步支持 JPA 项目,Alpha3 将会继续改进。

public class Main {           public static void main(String[] args) throws Exception {Container container = new Container();       container.start();      // Create a JDBC driver deployment using maven groupId:artifactId// The version is resolved from your pom.xml's DriverDeployment driverDeployment = new DriverDeployment(container, "com.h2database:h2", "h2");       container.deploy(driverDeployment);      // Create a DS deploymentDatasourceDeployment dsDeployment = new DatasourceDeployment(container, new Datasource("ExampleDS")        .connectionURL("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE")        .driver("h2")        .authentication("sa", "sa")       );       container.deploy(dsDeployment);      // Create the WAR and bundle all the JPA Entities and persistence.xmlWarDeployment deployment = new DefaultWarDeployment(container);       deployment.getArchive().addClasses(Employee.class);       deployment.getArchive().addClass(EmployeeServlet.class);       deployment.getArchive().addAsWebInfResource(new ClassLoaderAsset("META-INF/persistence.xml", Main.class.getClassLoader()), "classes/META-INF/persistence.xml");       deployment.getArchive().addAsWebInfResource(new ClassLoaderAsset("META-INF/load.sql", Main.class.getClassLoader()), "classes/META-INF/load.sql");       container.deploy(deployment);     } } 

大量示例:

正文到此结束
Loading...