Netbeans 8.2, glassfish 5
In my maven EAR proyect, when I clean+build, it generates an EAR file. If I add this file manually to my glassfish (via glassfish console) it deploys OK and run the application.
Added glassfish to netbeans, but when click run on glassfish service, server starts, but doesnt deploy nothing. EAR file generates OK but glassfish doesnt deploy it.
My POM file in the EAR project (REMOVED SOME DEPENDENCIES AND MODULES TO SHORT IT):
<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>
<artifactId>b2btravel.ear.deploy</artifactId>
<packaging>ear</packaging>
<name>B2B ear deploy</name>
<description>B2B Travel WEB-EAR deply</description>
<parent>
<groupId>b2btravel</groupId>
<artifactId>b2btravel</artifactId>
<version>1.4.11</version>
</parent>
<dependencies>
<!-- INTERNAL BUSINESS -->
<dependency>
<groupId>b2btravel</groupId>
<artifactId>b2btravel.business</artifactId>
<version>${project.version}</version>
<type>ejb</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>b2btravel</groupId>
<artifactId>b2btravel.web.bck</artifactId>
<version>${project.version}</version>
<type>war</type>
<scope>compile</scope>
</dependency>
<!-- EXTERNAL -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>${maven.ear.plugin}</version>
<goals>
<goal>generate-application-xml</goal>
<goal>ear</goal>
</goals>
<configuration>
<version>7</version>
<applicationId>${application.web.id}</applicationId>
<applicationName>${application.web.name}</applicationName>
<displayName>${application.web.display.name}</displayName>
<defaultLibBundleDir>lib/</defaultLibBundleDir>
<tempFolder>${project.build.directory}/${ear.web.file.name}</tempFolder>
<workDirectory>${project.build.directory}/${ear.web.file.name}/work</workDirectory>
<skinnyWars>true</skinnyWars>
<!-- If I want maven to generate the application.xml, set this to
true -->
<generateApplicationXml>true</generateApplicationXml>
<modules>
<!-- WEB MODULES -->
<jarModule>
<groupId>b2btravel</groupId>
<artifactId>b2btravel.web</artifactId>
<bundleDir>/</bundleDir>
<bundleFileName>b2btravel.web.jar</bundleFileName>
<includeInApplicationXml>false</includeInApplicationXml>
</jarModule>
<webModule>
<groupId>b2btravel</groupId>
<artifactId>b2btravel.web.bck</artifactId>
<bundleFileName>b2btravel.web.bck.war</bundleFileName>
<contextRoot>/bck</contextRoot>
</webModule>
<ejbModule>
<groupId>b2btravel</groupId>
<artifactId>b2btravel.business</artifactId>
<bundleFileName>b2btravel.business.jar</bundleFileName>
</ejbModule>
</modules>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
<finalName>${ear.web.file.name}</finalName>
</configuration>
</plugin>
</plugins>
</build>
</project>
Related
I'm trying to run my appium test on the BrowserStack device cloud with the use of Jenkins.
After adding the dependencies to my pom.xml mentioned in the following section
https://www.browserstack.com/app-automate/appium/jenkins#reporting
I received the following error:
[ERROR] Failed to execute goal com.browserstack:automate-maven-plugin:1.0.0-SNAPSHOT:test-compile (default) on project 1.0: Execution default of goal com.browserstack:automate-maven-plugin:1.0.0-SNAPSHOT:test-compile failed: Plugin com.browserstack:automate-maven-plugin:1.0.0-SNAPSHOT or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.codehaus.mojo:aspectj-maven-plugin:jar:${aspectj.maven.version}, org.aspectj:aspectjtools:jar:${aspectj.tools.version}: Could not find artifact org.codehaus.mojo:aspectj-maven-plugin:jar:${aspectj.maven.version} in central (https://repo.maven.apache.org/maven2) -> [Help 1]
My pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<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>xxxx</groupId>
<artifactId>1.0</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<jdk.source.version>1.8</jdk.source.version>
<jdk.target.version>1.8</jdk.target.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>${jdk.source.version}</source>
<target>${jdk.target.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!-- JUnit 5 requires Surefire version 2.22.0 or higher -->
<version>2.22.0</version>
</plugin>
<plugin>
<groupId>com.browserstack</groupId>
<artifactId>automate-maven-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<configuration>
<source>${jdk.source.version}</source>
<target>${jdk.target.version}</target>
<complianceLevel>${jdk.source.version}</complianceLevel>
</configuration>
<executions>
<execution>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.browserstack/automate-testassist -->
<dependency>
<groupId>com.browserstack</groupId>
<artifactId>automate-testassist</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
Can anyone help me with this problem?
<source>${jdk.source.version}</source>
<target>${jdk.target.version}</target>
<complianceLevel>${jdk.source.version}</complianceLevel>
you need to mention the jdk source and the targer versions here.
That's because BrowserStack repository no longer have a snapshot feature so you need to include the plugin as follows. You can check this answer for more on snapshot
<groupId>com.browserstack</groupId>
<artifactId>automate-maven-plugin</artifactId>
<version>1.0.0</version>
Without the SNAPSHOT
I am converting a Java EE project to a Maven project using IBM Rational Application Developer (RAD) which is based on Eclipse. IBM's instructions say to add the web project as a module in the EAR project but I am getting the error "Artifact[war:MoGEMS_WEB:MoGEMS_WEB] is not a dependency of the project." when I update the Maven project. I have included MoGEMS_WEB as a dependency and it is listed as a dependency when I click on the Dependencies tab in the EAR pom.xml file. The EAR pom file is:
<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>MoGEMSApp</groupId>
<artifactId>MoGEMSApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>ear</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10</version>
<configuration>
<version>5</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<security>
<security-role id="SecurityRole_1">
<role-name>Security Role</role-name>
</security-role>
</security>
<modules>
<webModule>
<groupId>MoGEMS_WEB</groupId>
<artifactId>MoGEMS_WEB</artifactId>
<contextRoot>/mogems</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>MoGEMSEJBClient</groupId>
<artifactId>MoGEMSEJBClient</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>MoGEMSEJB</groupId>
<artifactId>MoGEMSEJB</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>MoGEMS_WEB</groupId>
<artifactId>MoGEMS_WEB</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
I am trying to create ear with multiple wars. Let's say i have 3 web projects with the name web1, web2, web3. These 3 web projects repositories are placed in SVN. So now i wants to create a pom.xml file which creates ear with 3 wars by accessing 3 repositories in one ear file.
I tried it by placing all modules locally using below configuration.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.8</version>
<configuration>
<defaultJavaBundleDir>lib</defaultJavaBundleDir>
<skinnyWars>true</skinnyWars>
<archive>
<manifestEntries>
<Implementation-Description>${project.description}</Implementation-Description>
<Implementation-Vendor>Demo</Implementation-Vendor>
<Implementation-Version>${project.version}</Implementation-Version>
</manifestEntries>
</archive>
<modules>
<webModule>
<groupId>com.demo.ps</groupId>
<artifactId>web1</artifactId>
<bundleFileName>web1.war</bundleFileName>
<contextRoot>/web1</contextRoot>
</webModule>
<webModule>
<groupId>com.demo.ps</groupId>
<artifactId>web1</artifactId>
<bundleFileName>web2.war</bundleFileName>
<contextRoot>/web2</contextRoot>
</webModule>
</modules>
<defaultLibBundleDir>lib</defaultLibBundleDir>
</configuration>
</plugin>
and under dependencies
<dependency>
<groupId>com.demo.ps</groupId>
<artifactId>web1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.demo.ps</groupId>
<artifactId>web1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.demo.ps</groupId>
<artifactId>web2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.demo.ps</groupId>
<artifactId>web2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>pom</type>
</dependency>
by using above configuration it is creating 2 individual wars inside ear file, but i want some guidance to build same by accessing both repositories remotely.
Thanks in advance !!!!
I'm finishing my project build (with maven), and it's working great. Now I just have to "pack it", as an ear.
All I need to do is pack 3 dependencies, one .jar and 2 .war. Don't ask me how, that was the way it was done before (with ant), and I'm translating it to maven - next I'll organize the packages, so we can be more productive.
However, I'm having a few problems. First, the package is named null-${version}.ear. It copies itself right to the repository, but in the target folder is wrongly named. And second, it's copying all the other packages dependencies. I want to know what can I do about the null name, and the copying of the packages.
Here is my pom:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>owner</groupId>
<artifactId>coreisp</artifactId>
<version>2.0</version>
</parent>
<groupId>owner</groupId>
<artifactId>coreisp-app</artifactId>
<packaging>ear</packaging>
<version>2.0</version>
<name>Projeto CoreISP</name>
<dependencies>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>coreisp-core</artifactId>
<version>${pom.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>coreisp-initializer</artifactId>
<type>war</type>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>coreisp-site</artifactId>
<type>war</type>
<version>${pom.version}</version>
</dependency>
</dependencies>
<build>
<finalName>${application.id}-${pom.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.3</version>
<configuration>
<modules>
<jarModule>
<groupId>owner</groupId>
<artifactId>coreisp-core</artifactId>
<includeInApplicationXml>
true
</includeInApplicationXml>
<bundleDir>/</bundleDir>
</jarModule>
<webModule>
<groupId>owner</groupId>
<artifactId>
coreisp-initializer
</artifactId>
<bundleDir>/</bundleDir>
</webModule>
<webModule>
<groupId>owner</groupId>
<artifactId>
coreisp-site
</artifactId>
<bundleDir>/</bundleDir>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>
First of all remove the element from your POM, the application.id property is what gives you the "null" name.
As to ensure that transitive dependencies do not end up in your EAR I suggest you specify explicitly in your POM what you do want and what you do not want. In order to keep a dependency out all you need to do is define it in your POM with a scope of provided. I know it's a painful job, but in my opinion it's worth it, to ensure that you get exactly what you want.
I declared a custom jboss-app.xml in my pom.xml, but the plugin is generating an internal and empty jboss-app.xml file into ear/META-INF.
I created my pom.xml based on this article with the following definition:
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<data-sources>
<data-source>${artifactId}/src/main/resources/mytest-ds.xml</data-source>
</data-sources>
<jboss>${artifactId}/src/main/resources/jboss-app.xml</jboss>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<modules>
<ejbModule>
<groupId>com.testproject</groupId>
<artifactId>ejb-project</artifactId>
</ejbModule>
</modules>
</configuration>
</plugin>
But, I can't handle my custom jboss-app.xml. A new is empty descriptor (without defined ejbs) is generated every time.
You should be able to simply include your jboss-app.xml in your source tree and Maven will pull it in.
Your project directory structure for the maven-ear-plugin should look like:
|-- pom.xml
`-- src
`-- main
`-- application
`-- META-INF
|-- application.xml
`-- jboss-app.xml
Then just run mvn package to create your EAR. Assuming the packaging for your pom.xml is 'ear' it will pull jboss-app.xml into your resulting ear.
Also, I believe your <datasources>...</datasources> configuration needs to be within the <jboss>...</jboss> tags.
See also: http://maven.40175.n5.nabble.com/Deployment-of-the-jboss-app-xml-file-td45009.html
From the docs, it looks like jboss tag triggers the generation of jboss-app.xml. How about omitting this tag and generating the ear?
Alternative would be to pull datasources via application.xml as described here. But as <jarModule> requires are full-blown maven artifact, that is longer way (perhaps for application servers other than JBoss):
• project/ds/pom.xml:
<artifactId>project-ds</artifactId>
<packaging>jar</packaging>
<name>My DataSource</name>
• project/ds/src/main/resources/my-ds.xml:
<datasources>
<local-tx-datasource>
...
• project/ear/pom.xml (assuming that driver is also packaged in EAR):
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>project-ds</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>project-war</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>${jtds.driver.version}</version>
</dependency>
</dependencies>
...
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<modules>
<jarModule>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<includeInApplicationXml>true</includeInApplicationXml>
</jarModule>
<jarModule>
<groupId>${project.groupId}</groupId>
<artifactId>project-ds</artifactId>
<unpack>true</unpack>
<uri>/</uri>
<bundleFileName>my-ds.xml</bundleFileName>
<includeInApplicationXml>true</includeInApplicationXml>
</jarModule>
<webModule>
<groupId>${project.groupId}</groupId>
<artifactId>project-war</artifactId>
<contextRoot>${context.path}</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
Will generate META-INF/application.xml:
<application>
<display-name>project-ear</display-name>
<description>...</description>
<module>
<java>jtds-1.2.4.jar</java>
</module>
<module>
<java>my-ds.xml</java>
</module>
<module>
<web>
<web-uri>project-war-1.0.0.war</web-uri>
<context-root>/</context-root>
</web>
</module>
</application>