Reputation: 2084
Im trying to follow this tutorial: https://docs.jboss.org/author/display/AS7/Helloworld+quickstart
But getting build error when following the simple instructions to clean + build package:
gert@gert-VirtualBox:~/workspace/jboss-eap-6.1.0.GA-quickstarts/helloworld$ mvn clean package [INFO] Scanning for projects... [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project org.jboss.as.quickstarts:jboss-as-helloworld:7.1.2-SNAPSHOT (/home/gert/workspace/jboss-eap-6.1.0.GA-quickstarts/helloworld/pom.xml) has 4 errors [ERROR] Non-resolvable import POM: Failure to find org.jboss.spec:jboss-javaee-6.0:pom:3.0.2.Final-redhat-3 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ line 68, column 25 -> [Help 2]
I haven't edited the pom.xml file at all - shouldn't this just work?
I've googled it and came across this: https://community.jboss.org/message/762371#762371 But I don't seem to have a settings file anywhere?
Please, any help would be appreciated!
gvanto
POM FILE:
http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0
<groupId>org.jboss.as.quickstarts</groupId> <artifactId>jboss-as-helloworld</artifactId> <version>7.1.2-SNAPSHOT</version> <packaging>war</packaging> <name>JBoss AS Quickstarts: Helloworld</name> <description>JBoss AS Quickstarts: Helloworld</description> <url>http://jboss.org/jbossas</url> <licenses> <license> <name>Apache License, Version 2.0</name> <distribution>repo</distribution> <url>http://www.apache.org/licenses/LICENSE-2.0.html</url> </license> </licenses> <properties> <!-- Explicitly declaring the source encoding eliminates the following message: --> <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! --> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- JBoss dependency versions --> <version.org.jboss.as.plugins.maven.plugin>7.3.Final</version.org.jboss.as.plugins.maven.plugin> <!-- <version.org.jboss.spec.jboss.javaee.6.0>3.0.2.Final</version.org.jboss.spec.jboss.javaee.6.0>
--> 3.0.2.Final-redhat-3
<!-- other plugin versions --> <version.compiler.plugin>2.3.1</version.compiler.plugin> <version.war.plugin>2.1.1</version.war.plugin> <!-- maven-compiler-plugin --> <maven.compiler.target>1.6</maven.compiler.target> <maven.compiler.source>1.6</maven.compiler.source> </properties> <dependencyManagement> <dependencies> <!-- Define the version of JBoss' Java EE 6 APIs we want to use --> <!-- 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-6.0 stack (you can read this as the JBoss stack of the Java EE 6 APIs). You can actually use this stack with any version of JBoss AS that implements Java EE 6, not just JBoss AS 7! --> <dependency> <groupId>org.jboss.spec</groupId> <artifactId>jboss-javaee-6.0</artifactId> <version>${version.org.jboss.spec.jboss.javaee.6.0}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- Import the CDI API, we use provided scope as the API is included in JBoss AS 7 --> <dependency> <groupId>javax.enterprise</groupId> <artifactId>cdi-api</artifactId> <scope>provided</scope> </dependency> <!-- Import the Common Annotations API (JSR-250), we use provided scope as the API is included in JBoss AS 7 --> <dependency> <groupId>org.jboss.spec.javax.annotation</groupId> <artifactId>jboss-annotations-api_1.1_spec</artifactId> <scope>provided</scope> </dependency> <!-- Import the Servlet API, we use provided scope as the API is included in JBoss AS 7 --> <dependency> <groupId>org.jboss.spec.javax.servlet</groupId> <artifactId>jboss-servlet-api_3.0_spec</artifactId> <scope>provided</scope> </dependency> </dependencies> <build> <!-- Set the name of the war, used as the context root when the app is deployed --> <finalName>jboss-as-helloworld</finalName> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <version>${version.war.plugin}</version> <configuration> <!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! --> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> <!-- JBoss AS plugin to deploy war --> <plugin> <groupId>org.jboss.as.plugins</groupId> <artifactId>jboss-as-maven-plugin</artifactId> <version>${version.org.jboss.as.plugins.maven.plugin}</version> </plugin> <!-- Compiler plugin enforces Java 1.6 compatibility and activates annotation processors --> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>${version.compiler.plugin}</version> <configuration> <source>${maven.compiler.source}</source> <target>${maven.compiler.target}</target> </configuration> </plugin> </plugins> </build>
Upvotes: 7
Views: 8564
Reputation: 179
Removing of redHat "postfix" resolved the problem, just have actual jar name, instead of having redHat postfix.
Have below dependencies in your pom.xml, then it will build successfully.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>3.0.2.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.0-SP4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.annotation</groupId>
<artifactId>jboss-annotations-api_1.1_spec</artifactId>
<version>1.0.1.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
<version>1.0.2.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>
Upvotes: 1
Reputation: 3120
If you clone the quickstarts from the github repository, e.g.
git clone --recursive git://github.com/jboss-jdf/jboss-as-quickstart.git --branch jdf-2.1.9.Final
See: http://www.jboss.org/jdf/quickstarts/get-started/
then you will find a maven settings.xml file in the root directory (./jboss-as-quickstart/settings.xml)
For each example, run maven with that settings file:
cd jboss-as-quickstart
cd helloworld
mvn -s ..\settings.xml compile
See: http://www.jboss.org/jdf/quickstarts/jboss-as-quickstart/#configure-maven
Upvotes: 5
Reputation: 2084
OK, here's what fixed it:
Commented out this line in the pom.xml: (I thought this is a type of variable that gets automatically inserted/replaced by eclipse/something, turns out NO IT IS NOT):
<!-- <version>${version.org.jboss.spec.jboss.javaee.6.0}</version> -->
Replace with:
<version>3.0.2.Final</version>
It now builds and I can deploy it fine, thanks for the help Nishant!
Upvotes: 5
Reputation:
You might have to create one (see this page for more details):
There are two locations where a settings.xml file may live:
- The Maven install: $M2_HOME/conf/settings.xml
- A user's install: ${user.home}/.m2/settings.xml
But I feel the issue is with the version string of the dependency. Hardcode the version and try again:
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>3.0.2.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Uncommenting the following line might work too:
<version.org.jboss.spec.jboss.javaee.6.0>3.0.2.Final
</version.org.jboss.spec.jboss.javaee.6.0>
Upvotes: 3