Eclipse Web application deployment problem with Maven on JBoss - java

I have the following pom.xml (see below) for building a web-app on JBoss. I run maven like this :
mvn clean compile war:exploded jboss:hard-undeploy jboss:hard-deploy jboss:start-and-wait
Every goals run fine until i hit jboss:start-and-wait goal :\ JBoss refuses to start.
I got the following error :
(...)
[INFO] [jboss:start-and-wait {execution: default-cli}]
[INFO] Starting JBoss...
[INFO] Waiting to retrieve JBoss JMX MBean connection...
[INFO] Waiting to retrieve JBoss JMX MBean connection...
[INFO] Waiting to retrieve JBoss JMX MBean connection...
[INFO] Waiting to retrieve JBoss JMX MBean connection...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Unable to get JBoss JMX MBean connection: null
org.jboss.jmx.adaptor.rmi.RMIAdaptor
(...)
By activating the DEBUG option on maven, i detected that the root cause is a ClassNotFoundException
org.jboss.jmx.adaptor.rmi.RMIAdaptor. Why do I get this exception since my pom.xml
does contain org.jboss.jmx.adaptor.rmi.RMIAdaptor in the jmx-adaptor-plugin jar dependency ?
Using jboss-all-client jar as dependency gives no more results.
What am I missing ?
Stephan
Configuration
Maven 2.2.1
JBoss 5.1.0.GA
JBoss Maven Plugin 1.5.0
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>foo</artifactId>
<groupId>com.company.foo</groupId>
<version>1.0.0</version>
</parent>
<groupId>com.company.foo</groupId>
<artifactId>foo-webapp</artifactId>
<packaging>war</packaging>
<name>foo-webapp</name>
<version>1.0.0</version>
<dependencies>
<!-- JSF 2.0 -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.3-b02</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.3-b02</version>
</dependency>
<!-- Primefaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<!-- <version>3.0.M1</version> -->
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>redmond</artifactId>
<version>1.0.0</version>
</dependency>
<!-- Others -->
<dependency>
<groupId>com.company.record</groupId>
<artifactId>record-dao</artifactId>
<version>1.0.0</version>
</dependency>
<!-- Postgresql -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.3-606.jdbc4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jmx-adaptor-plugin</artifactId>
<version>3.2.1</version>
</dependency>
</dependencies>
<build>
<finalName>foo.war</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<useCache>false</useCache>
<!-- Prevent a bug from plugin (see http://jira.codehaus.org/browse/MWAR-248) -->
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<fileName>${project.build.directory}/${project.build.finalName}</fileName>
<serverName>web</serverName>
</configuration>
</plugin>
</plugins>
</build>
(...)

Try adding it to your plugin dependencies:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<fileName>${project.build.directory}/${project.build.finalName}</fileName>
<serverName>web</serverName>
</configuration>
<dependencies>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
<type>pom</type>
<version>5.1.0.GA</version>
</dependency>
</dependencies>
</plugin>

Related

error compiling[m: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor

I am facing below error while building code Spring Boot and Apache Avro example from STS, however if I run this code command line it works well.
[INFO] [1m--- [0;32mmaven-compiler-plugin:3.8.1:compile[m [1m(default-compile)[m # [36mavroposgen[0;1m ---[m
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to E:\Kafka-Streams-with-Spring-Cloud\avroposgen\target\classes
[INFO] [1m------------------------------------------------------------------------[m
[INFO] [1;31mBUILD FAILURE[m
[INFO] [1m------------------------------------------------------------------------[m
[INFO] Total time: 5.729 s
[INFO] Finished at: 2021-12-15T22:00:20+05:30
[INFO] [1m------------------------------------------------------------------------[m
[ERROR] Failed to execute goal [32morg.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile[m [1m(default-compile)[m on project [36mavroposgen[m: [1;31mFatal error compiling[m: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module #0x18ff1520) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module #0x18ff1520 -> [1m[Help 1][m
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the [1m-e[m switch.
[ERROR] Re-run Maven using the [1m-X[m switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [1m[Help 1][m http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
pom.xml
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>learningjournal.guru.examples</groupId>
<artifactId>avroposgen</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Avro Pos Generator</name>
<description>Avro Pos Generator by Learning Journal</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>io.confluent</groupId>
<artifactId>kafka-avro-serializer</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.avro</groupId>
<artifactId>avro-maven-plugin</artifactId>
<version>1.8.2</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>schema</goal>
</goals>
<configuration>
<sourceDirectory>src/main/avro</sourceDirectory>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
<imports>
<import>${project.basedir}/src/main/avro/LineItem.avsc</import>
<import>${project.basedir}/src/main/avro/DeliveryAddress.avsc</import>
</imports>
<stringType>String</stringType>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>confluent</id>
<url>https://packages.confluent.io/maven/</url>
</repository>
</repositories>
</project>
In eclipse go to->
Step 1 : window->preference->java->complier-> set compiler compliance level to 1.8 if you are using jdk1.8 or java8
Step 2:window->preference->java->installed JREs->
EDIT(if your installed JRE is not being used)->
JRE HOME : (the one which you have installed in your system jre path
should be that of inside jdk)
in my case it is-> C:\Program Files\Java\jdk1.8.0_291\jre
Please try to change these config of your ide.
Seems your compiler or jre version is not matched in ide as per installed
java version.

Can't compile multi module Spring project with Maven

I took an older Java 11, Spring based multi module project that I didn't work on since about two years and tried to make it compile and run on my new laptop. It worked on my old laptop, but I can't make it run on the new laptop. When running mvn clean install the module called "util" compiles fine. But the "shared" module, which requires the "util" module, does not find the util module: "cannot find symbol". What happens is that all the fxml and image files are copied to the target directory but there is not a single class file. Because the information about the issue was very limited in STS (Spring development tool) I installed Maven 3.8.2. and tried to fix it from the command line. Based on the information and what I found in the internet I added org.codehaus.mojoversions-maven-plugin and org.apache.maven.plugins:maven-enforcer-plugin plus I tried with and without explicit version tags, since I got warnings as the versions are already defined in spring-boot-dependencies-2.5.4.pom.pom. So, when I run mvn versions:display-plugin-updates I find the outcome very confusing, since in the very end it states "BUILD SUCCESS" but if I scroll up, there is an Error message saying: "Project does not define required minimum version of Maven. Update the pom.xml to contain maven-enforcer-plugin to force the maven version which is needed to build this project". But this is what I did?!
Please see below the current parent pom. Please let me know should you need more information. Thank you in advance for your help.
Please have in mind that my expertise in Maven is rather limited. I understand the basics, when it gets to all these plugins, I get lost. Therefore, I would be grateful for "dummies" style answers.
<?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>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.4</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.agiletunes</groupId>
<artifactId>agiletunes-parent</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>
<name>agiletunes-parent</name>
<description>Maven parent for all agileTunes modules</description>
<modules>
<module>../agiletunes-productmanager</module>
<module>../agiletunes-testmanager</module>
<module>../agiletunes-shared</module>
<module>../agiletunes-authserver</module>
<module>../agiletunes-util</module>
</modules>
<properties>
<java.version>11</java.version>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- for testing Spring Boot applications with JUnit -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.5</version>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.0</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
This is happening because what you defined in the configurations of the maven-enforcer-plugin actually maven-enforcer-plugin runs in the validation life cycle and when you run the mvn versions:display-plugin-updates with the below configurations what happen is,
<requireMavenVersion>
<version>3.0.0</version>
</requireMavenVersion>
it will check the project maven version and then check the plugin versions, and you will get an error if the project minimum version is not compatible with the plugin versions.
[INFO] Project inherits minimum Maven version as: 3.0.0
[INFO] Plugins require minimum Maven version of: 3.1.1
[INFO] Note: the super-pom from Maven 3.6.3 defines some of the plugin
[INFO] versions and may be influencing the plugins required minimum Maven
[INFO] version.
[INFO]
[ERROR] Project requires an incorrect minimum version of Maven.
[ERROR] Update the pom.xml to contain maven-enforcer-plugin to
[ERROR] force the Maven version which is needed to build this project.
[ERROR] See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html
[ERROR] Using the minimum version of Maven: 3.0.0
so what you can do is change the version in the maven-enforcer-plugin to the project version.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.1.1</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
and after that, the error will be gone,
[INFO] Project inherits minimum Maven version as: 3.1.1
[INFO] Plugins require minimum Maven version of: 3.1.1
[INFO] Note: the super-pom from Maven 3.6.3 defines some of the plugin
[INFO] versions and may be influencing the plugins required minimum Maven
[INFO] version.
[INFO]
[INFO] No plugins require a newer version of Maven than specified by the pom.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
but actually you don't need maven-enforcer-plugin to define, I'm not sure if there is a list of plugins that don't need to be explicitly added, but I assume it's the most common ones like maven-surefire-plugin and maven-clean-plugin

How to Distributable Artifact/Classifier Jars : Complaining of missing pom file

Project background; large amounts of JNI projects for my group. Looking to simplify the build/release strategies as the JNI projects themselves have dependency chains.
Used a model similar to here: http://mail-archives.apache.org/mod_mbox/maven-users/200706.mbox/%3C56761.84.233.182.145.1181035390.squirrel#www.sharp.fm%3E as a prototype that works well. A distribution module adds the appropriate jars and the classifier is used. Example final jar would be CiscoJ-dist-unix-amd64.jar.
Problem I'm hitting appears that install creates the project pom but attempting to use the classifier jar in a project, its is looking for the pom file matching the classifier; thus from above its looking for J-dist-unix-amd64.pom. The only pom that exists is of course the project pom J-dist.pom.
[WARNING]
The POM for com.cisco.ciscossl:CiscoJ-dist:jar:unix-amd64:1.00 is missing, no
dependency information available [DEBUG] Dependency collection stats:
{ConflictMarker.analyzeTime=1, ConflictMarker.markTime=0,
ConflictMarker.nodeCount=4, ConflictIdSorter.graphTime=0,
ConflictIdSorter.topsortTime=1, ConflictIdSorter.conflictIdCount=3,
ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2,
ConflictResolver.conflictItemCount=3,
DefaultDependencyCollector.collectTime=290,
DefaultDependencyCollector.transformTime=6}
In project attempting to build with architecture dependent information.
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>com.cisco.ciscossl</groupId>
<artifactId>CiscoJ-dist</artifactId>
<classifier>${os.family}-${os.arch}</classifier>
<version>1.00</version>
</dependency>
</dependencies>
According to this; http://maven.40175.n5.nabble.com/pom-does-not-get-installed-if-classifier-used-td120388.html; it should be fixed with my version of maven (3.1.1).
Pom File of Project
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.cisco.ciscossl.CiscoJ</groupId>
<artifactId>CiscoJ-dist</artifactId>
<version>1.00</version>
<packaging>jar</packaging>
<parent>
<groupId>com.cisco.ciscossl</groupId>
<artifactId>CiscoJ</artifactId>
<version>1.00</version>
</parent>
<dependencies>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>CiscoJUtils</artifactId>
<version>1.00</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>CiscoJCE</artifactId>
<version>1.00</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>CiscoJSafeC</artifactId>
<version>1.00</version>
<classifier>${os.family}-${os.arch}</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>CiscoJCEJNI</artifactId>
<version>1.00</version>
<classifier>${os.family}-${os.arch}</classifier>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>package-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/dist-jar.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Assembler:
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>${os.family}-${os.arch}</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<excludes>
<exclude>org.slf4j:slf4j-simple</exclude>
<exclude>org.slf4j:slf4j-api</exclude>
<exclude>junit:junit</exclude>
</excludes>
<unpack>true</unpack>
<useTransitiveDependencies>false</useTransitiveDependencies>
</dependencySet>
</dependencySets>
</assembly>
I messed a bit with the maven-install-plugin install-file for the artifact, not much success yet though.
I think I determined that I had an invalid artifact in the file attempting to use the artifact. I believe, and looks like it worked, that should be accessing it with the parent project as part of the group id/path. Like below...
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>com.cisco.ciscossl.CiscoJ</groupId>
<artifactId>CiscoJ-dist</artifactId>
<classifier>${os.family}-${os.arch}</classifier>
<version>1.00</version>
</dependency>
</dependencies>
khmarbaise, much appreciated to comments of the above. Leaving open for now until further determine that this wasn't the valid answer. At least for now I can see a valid dependency tree being picked up....
[INFO] Building test-CiscoJ-disk 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # test-CiscoJ-dist ---
[INFO] com.cisco.ciscossl:test-CiscoJ-dist:jar:0.0.1-SNAPSHOT
[INFO] +- junit:junit:jar:4.11:compile
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] \- com.cisco.ciscossl.CiscoJ:CiscoJ-dist:jar:unix-amd64:1.00:compile
[INFO] +- org.slf4j:slf4j-simple:jar:1.7.2:compile
[INFO] \- org.slf4j:slf4j-api:jar:1.7.2:compile
[INFO] ------------------------------------------------------------------------

Error when deploying project

I have a problem with deploying a project created with maven. I make a clean project i try to deploy it with "mvn clean package jboss-as:deploy" immediately but i get this error: "The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid version could be found". It felt strange to me, beacuse the project is "clean". So i found this: The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid version could be found but then just another error appeared instead of the older. I have jboss 7.1.1, and jdk 6 (for some reason I couldn't get newer version), ubuntu 10.04.4 LTS 64-bit.
I would appreciate some help
//Edit: pom.xml:
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.edu.agh.soa</groupId>
<artifactId>zad1h</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>zad1h application</name>
<modules>
<module>zad1h-ejb</module>
<module>zad1h-web</module>
<module>zad1h-ear</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Define the version of JBoss' Java EE 6 APIs we want to import.
Any dependencies from org.jboss.spec will have their version defined by this
BOM -->
<javaee6.web.spec.version>2.0.0.Final</javaee6.web.spec.version>
<!-- Alternatively, comment out the above line, and un-comment the line below to
use version 3.0.0.Beta1-redhat-1 which is a release certified
to work with JBoss EAP 6. It requires you have access to the JBoss EAP 6 maven repository. -->
<!--
<javaee6.web.spec.version>3.0.0.Beta1-redhat-1</javaee6.web.spec.version>
-->
</properties>
<dependencyManagement>
<dependencies>
<!-- Define the version of the EJB jar so that we don't need to
repeat ourselves in every module -->
<dependency>
<groupId>pl.edu.agh.soa</groupId>
<artifactId>zad1h-ejb</artifactId>
<version>1.0</version>
<type>ejb</type>
</dependency>
<!-- Define the version of the WAR so that we don't need to repeat
ourselves in every module -->
<dependency>
<groupId>pl.edu.agh.soa</groupId>
<artifactId>zad1h-web</artifactId>
<version>1.0</version>
<type>war</type>
<scope>compile</scope>
</dependency>
<!-- JBoss distributes a complete set of Java EE 6 APIs including
a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or
a collection) of artifacts. We use this here so that we always get the correct
versions of artifacts. Here we use the jboss-javaee-web-6.0 stack (you can
read this as the JBoss stack of the Java EE Web Profile 6 APIs) -->
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-web-6.0</artifactId>
<version>${javaee6.web.spec.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- JSR-303 (Bean Validation) Implementation -->
<!-- Provides portable constraints such as #Email -->
<!-- Hibernate Validator is shipped in JBoss AS 7 -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<!-- Compiler plugin enforces Java 1.6 compatibility and activates
annotation processors -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- The JBoss AS plugin deploys your ear to a local JBoss AS
container -->
<!-- Due to Maven's lack of intelligence with EARs we need to
configure the jboss-as maven plugin to skip deployment for all modules. We
then enable it specifically in the ear module. -->
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.1.0.Beta1b</version>
<inherited>true</inherited>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Try this dependency, this one seems to be latest instead of maven-jboss-as-plugin
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.5.Final</version>
</plugin>
See
https://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/deployment-example.html
Have you tried to delete the .m2 local repo?
It's a good work-around for problem like yours...

Maven Fatal Error on struts2-archetype-blank

I'm trying to start a new struts 2 project using maven (struts2 blank archetype)
The code below runs and generates the project along with its pom.xml
D:\Dev\IndigoWS>mvn archetype:generate -B DgroupId=com.proj.core -DartifactId=MyStruts2Blank -DarchetypeGroupId=org.apache.struts -DarchetypeArtifactId=struts2-ar
chetype-blank -DarchetypeVersion=2.2.1
with the following stacktrace from the terminal.
[INFO] Building Maven Default Project
[INFO] task-segment: [archetype:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] [archetype:generate {execution: default-cli}]
[INFO] Generating project in Batch mode
[INFO] Archetype repository missing. Using the one from [org.apache.struts:strut
s2-archetype-blank:2.2.3] found in catalog remote
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
but whenever I try to convert it into an eclipse project using the command
mvn eclipse:eclipse -Dwtpversion=1.5
I encountered the fatal error below
D:\Dev\MyWorkspace>cd MyStruts2Blank
D:\Dev\MyWorkspace\MyStruts2Blank>mvn eclipse:eclipse -Dwtpversion=1.5
[INFO] Scanning for projects...
[INFO]---------------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO]------------------------------------------------------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: com.proj.core:MyStruts2Blank POM Location:
D:\Dev\MyWorkspace\MyStruts2Blank\pom.xml
the pom.xml
<?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>com.royj.core</groupId>
<artifactId>MyStruts2Blank</artifactId>
<version>${project.version}</version>
<packaging>war</packaging>
<name>Struts 2 Blank Webapp</name>
<properties>
<struts2.version>${project.version}</struts2.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-junit-plugin</artifactId>
<version>${struts2.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>2.0.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.21</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<scanTargets>
<scanTarget>src/main/webapp/WEB-INF</scanTarget>
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
<scanTarget>src/main/resources/struts.xml</scanTarget>
<scanTarget>src/main/resources/example.xml</scanTarget>
</scanTargets>
</configuration>
</plugin>
</plugins>
</build>
</project>
and the maven version
Apache Maven 2.2.1 (r801777; 2009-08-07 03:16:01+0800)
Java version: 1.6.0_24
Java home: C:\Program Files\Java\jdk1.6.0_24\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
What do I need to do to fix this and successfully generate a struts 2 blank archetype. I can successfully create a starter archetype for struts 2 using maven but with no success for the blank archetype. Is the blank archetype no longer available? By the way I am using Eclipse Indigo Version: Indigo , Release Build id: 20110615-0604
Thanks in advance guys.
The first i have to say don't use mvn eclipse:eclipse in relationship with Eclipse Indigo anymore, cause you have m2e as part of Indigo furthermore install m2e wtp plugin via Eclipse Marketplace. Where is your project.version defined, cause you are using it in relationship with your struts version but in your pom you didn't define any version.
<?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>com.royj.core</groupId>
<artifactId>MyStruts2Blank</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Struts 2 Blank Webapp</name>
<properties>
<struts2.version>2.3.1.2</struts2.version>
</properties>
...
</project>
Apart from that i would suggest to upgrade to Maven 3.0.3 cause Eclipse Indigo uses a Maven 3. embedded.

Categories

Resources