I am a newcomer in Maven and I want to import my application to maven. I want to, as before, refer on classes in my ejb-project into my war-project. I have no errors in classes, but if I make maven install on my Parent project then my war-project give me this error:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project SportunionWARModule: Compilation failure: Compilation failure:
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/AdministratorenView.java:[6,37] package com.sportunion.project.domain does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/AdministratorenView.java:[7,37] package com.sportunion.project.domain does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/AdminEditor.java:[7,37] package com.sportunion.project.domain does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/AdministratorenView.java:[41,30] cannot find symbol
[ERROR] symbol: class Admins
[ERROR] location: class com.sportunion.AdministratorenView
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/AdministratorenView.java:[42,30] cannot find symbol
[ERROR] symbol: class Log
[ERROR] location: class com.sportunion.AdministratorenView
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/CSVLoader.java:[8,30] package com.sportunion.project does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/CSVLoader.java:[9,36] package com.sportunion.project.utils does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/CSVLoader.java:[13,9] cannot find symbol
[ERROR] symbol: class UsersService
[ERROR] location: class com.sportunion.CSVLoader
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/BenutzerView.java:[9,37] package com.sportunion.project.domain does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/BenutzerView.java:[53,30] cannot find symbol
[ERROR] symbol: class Users
[ERROR] location: class com.sportunion.BenutzerView
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/Ranking.java:[8,37] package com.sportunion.project.domain does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/Ranking.java:[23,30] cannot find symbol
[ERROR] symbol: class Users
[ERROR] location: class com.sportunion.Ranking
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/MyUI.java:[8,37] package com.sportunion.project.domain does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/MyUI.java:[9,37] package com.sportunion.project.domain does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/MyUI.java:[10,37] package com.sportunion.project.domain does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/MyUI.java:[35,25] cannot find symbol
[ERROR] symbol: class Admins
[ERROR] location: class com.sportunion.MyUI
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/MyUI.java:[36,29] cannot find symbol
[ERROR] symbol: class Users
[ERROR] location: class com.sportunion.MyUI
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/MyUI.java:[37,29] cannot find symbol
[ERROR] symbol: class Users
[ERROR] location: class com.sportunion.MyUI
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/MyUI.java:[38,29] cannot find symbol
[ERROR] symbol: class Log
[ERROR] location: class com.sportunion.MyUI
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/LogView.java:[7,37] package com.sportunion.project.domain does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/LogView.java:[30,30] cannot find symbol
[ERROR] symbol: class Log
[ERROR] location: class com.sportunion.LogView
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/LoginView.java:[8,30] package com.sportunion.project does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/LoginView.java:[9,37] package com.sportunion.project.domain does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/LoginView.java:[10,30] package com.sportunion.project does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/LoginView.java:[11,36] package com.sportunion.project.utils does not exist
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/AdministratorenView.java:[101,32] cannot find symbol
[ERROR] symbol: class Admins
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/AdministratorenView.java:[101,68] cannot find symbol
[ERROR] symbol: class Admins
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/AdministratorenView.java:[101,80] cannot find symbol
[ERROR] symbol: class Admins
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/CSVLoader.java:[13,30] cannot find symbol
[ERROR] symbol: variable PTServiceLocator
[ERROR] location: class com.sportunion.CSVLoader
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/BenutzerView.java:[118,40] cannot find symbol
[ERROR] symbol: class Users
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/BenutzerView.java:[118,75] cannot find symbol
[ERROR] symbol: class Users
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/BenutzerView.java:[118,86] cannot find symbol
[ERROR] symbol: class Users
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/MyUI.java:[66,64] cannot find symbol
[ERROR] symbol: class Admins
[ERROR] location: class com.sportunion.MyUI
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/MyUI.java:[67,63] cannot find symbol
[ERROR] symbol: class Users
[ERROR] location: class com.sportunion.MyUI
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/MyUI.java:[68,65] cannot find symbol
[ERROR] symbol: class Users
[ERROR] location: class com.sportunion.MyUI
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/MyUI.java:[69,61] cannot find symbol
[ERROR] symbol: class Log
[ERROR] location: class com.sportunion.MyUI
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/LoginView.java:[41,13] cannot find symbol
[ERROR] symbol: class AdminsService
[ERROR] location: class com.sportunion.LoginView
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/LoginView.java:[41,36] cannot find symbol
[ERROR] symbol: variable PTServiceLocator
[ERROR] location: class com.sportunion.LoginView
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/LoginView.java:[42,13] cannot find symbol
[ERROR] symbol: class LogService
[ERROR] location: class com.sportunion.LoginView
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/LoginView.java:[42,30] cannot find symbol
[ERROR] symbol: variable PTServiceLocator
[ERROR] location: class com.sportunion.LoginView
[ERROR] /C:/jboss/workspace/Sportunion_Maven/SportunionParent/SportunionWARModule/src/main/java/com/sportunion/LoginView.java:[58,17] cannot find symbol
[ERROR] symbol: class Admins
Does anyone now whats my mistake is?
this is my pom.xml
of the war-Project:
<?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>
<parent>
<artifactId>SportunionParent</artifactId>
<groupId>SportunionParent</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>SportunionParent</groupId>
<artifactId>SportunionWARModule</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>SportunionWARModule</name>
<properties>
<vaadin.version>7.6.4</vaadin.version>
<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
<jetty.plugin.version>9.2.3.v20140905</jetty.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
</snapshots>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<scope>provided</scope>
</dependency>
<!--
Needed when using the widgetset optimizer (custom ConnectorBundleLoaderFactory).
For widgetset compilation, vaadin-client-compiler is automatically added on the
compilation classpath by vaadin-maven-plugin so normally there is no need for an
explicit dependency.
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<scope>provided</scope>
</dependency>-->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
</dependency>
<dependency>
<groupId> com.vaadin.addon </groupId>
<artifactId> jpacontainer </artifactId>
<version> 3.1.1 </version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>3.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<!-- Exclude some unnecessary files generated by the GWT compiler. -->
<packagingExcludes>WEB-INF/classes/VAADIN/gwt-unitCache/**,
WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.plugin.version}</version>
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<webappDirectory>${basedir}/target/classes/VAADIN/widgetsets</webappDirectory>
<draftCompile>false</draftCompile>
<compileReport>false</compileReport>
<style>OBF</style>
<strict>true</strict>
</configuration>
<executions>
<execution>
<goals>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<!-- Comment out compile-theme goal to use on-the-fly theme compilation -->
<!-- <goal>compile-theme</goal> -->
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
<!-- Clean up also any pre-compiled themes -->
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/VAADIN/themes</directory>
<includes>
<include>**/styles.css</include>
<include>**/styles.scss.cache</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- The Jetty plugin allows us to easily test the development build by
running jetty:run on the command line. -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.plugin.version}</version>
<configuration>
<scanIntervalSeconds>2</scanIntervalSeconds>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- Vaadin pre-release repositories -->
<id>vaadin-prerelease</id>
<activation>
</activation>
<repositories>
<repository>
<id>vaadin-prereleases</id>
<url>http://maven.vaadin.com/vaadin-prereleases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>vaadin-prereleases</id>
<url>http://maven.vaadin.com/vaadin-prereleases</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
this is my pom.xml
of my ejb-project:
<?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>
<parent>
<artifactId>SportunionParent</artifactId>
<groupId>SportunionParent</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>SportunionParent</groupId>
<artifactId>SportunionEJBModule</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>ejb</packaging>
<name>SportunionEJBModule</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<ejbVersion>3.1</ejbVersion>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!-- without this, the datetime stamp unique id's will be appended to classpath items -->
<!-- see: http://maven.apache.org/shared/maven-archiver/examples/classpath.html#Snapshot -->
<useUniqueVersions>false</useUniqueVersions>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
and this one from my ear-project:
<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>
<parent>
<groupId>SportunionParent</groupId>
<artifactId>SportunionParent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>SportunionEARModule</artifactId>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>SportunionParent</groupId>
<artifactId>SportunionWARModule</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>SportunionParent</groupId>
<artifactId>SportunionEJBModule</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>ejb</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.0.2.Final</version>
<configuration>
<hostname>127.0.0.1</hostname>
<port>9090</port>
<!-- <jbossHome>C:/tools/wildfly-8.0.0.Final</jbossHome> -->
</configuration>
</plugin>
</plugins>
</build>
<groupId>SportunionParent</groupId>
<version>0.0.1-SNAPSHOT</version>
</project>
I would be happy if anyone could help me... Thanks in advice!
As you mentioned, the missing elements are present on your EJB module.
Therefore, you need to remove your EJB module as a dependency from your EAR and add it to your WAR module. In your WAR's pom.xml file, add the following:
<dependencies>
(...)
<dependency>
<groupId>SportunionParent</groupId>
<artifactId>SportunionEJBModule</artifactId>
<version>${project.version}</version>
</dependency>
(...)
</dependencies>
Also, since the EJB module is now a dependency of your WAR, I believe there's no need for you to have an EAR. Maven will place your EJB module on the WEB-INF/lib of your WAR.