Use Maven to add JDBC-Driver and Datasource to Wildfly



<plugin>
	<groupId>org.wildfly.plugins</groupId>
	<artifactId>wildfly-maven-plugin</artifactId>
	<version>1.1.0.Alpha8</version>
	<executions>
		<execution>
			<id>deploy-postgresql</id>
			<phase>package</phase>
			<goals>
				<goal>deploy-artifact</goal>
			</goals>
			<configuration>
				<force>true</force>
				<groupId>org.postgresql</groupId>
				<artifactId>postgresql</artifactId>
				<name>postgresql-9.4-1206-jdbc42.jar</name>
			</configuration>
		</execution>
		<execution>
			<id>add-datasource</id>
			<phase>install</phase>
			<goals>
				<goal>add-resource</goal>
			</goals>
			<configuration>
				<skip>true</skip>
				<force>false</force>
				<address>subsystem=datasources</address>
				<resources>
					<resource>
						<address>xa-data-source=java:/myDS</address>
						<properties>
							<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
							<jndi-name>java:/myDS</jndi-name>
							<enabled>true</enabled>
							<driver-name>postgresql-9.4-1206-jdbc42.jar</driver-name>
						</properties>
						<resources>
							<resource>
								<address>xa-datasource-properties=DatabaseName</address>
								<properties>
									<value>myDatabase</value>
								</properties>
							</resource>
							<resource>
								<address>xa-datasource-properties=ServerName</address>
								<properties>
									<value>myLocalhost</value>
								</properties>
							</resource>
							<resource>
								<address>xa-datasource-properties=User</address>
								<properties>
									<value>myUser</value>
								</properties>
							</resource>
							<resource>
								<address>xa-datasource-properties=Password</address>
								<properties>
									<value>myPassword</value>
								</properties>
							</resource>
						</resources>
					</resource>
				</resources>
			</configuration>
		</execution>
	</executions>
</plugin>

Archive

No Responses

Leave a reply

*

17 + zwanzig =