部署项目时出错

时间:2014-04-28 15:17:35

标签: java maven jboss

我在部署使用maven创建的项目时遇到问题。我做了一个干净的项目,我尝试使用" mvn clean package jboss-as:deploy"我立即得到了这个错误:"插件' org.apache.maven.plugins:maven-jboss-as-plugin'不存在或找不到有效版本"。对我来说这感觉很奇怪,因为这个项目是"清洁"。所以我发现了这个:The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid version could be found然后又出现了另一个错误,而不是旧版本。我有jboss 7.1.1和jdk 6(由于某种原因我无法获得更新版本),ubuntu 10.04.4 LTS 64位。

我很感激一些帮助

//编辑: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>

2 个答案:

答案 0 :(得分:0)

尝试这种依赖,这个似乎是最新的而不是maven-jboss-as-plugin

<plugin>
        <groupId>org.jboss.as.plugins</groupId>
            <artifactId>jboss-as-maven-plugin</artifactId>
            <version>7.5.Final</version>
        </plugin>

请参阅 https://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/deployment-example.html

答案 1 :(得分:0)

您是否尝试删除.m2本地回购?

对于像你这样的问题来说,这是一个很好的解决方法......