【问题标题】:Error when deploying project部署项目时出错
【发布时间】:2014-04-28 15:17:34
【问题描述】:

我在部署使用 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>

【问题讨论】:

  • 您使用的是什么版本的 maven-jboss-as-plugin?你能从 pom.xml 粘贴它的依赖关系吗
  • 7​​.1.0.Beta1b
  • 您介意粘贴 POM sn-p 吗?

标签: java maven jboss


【解决方案1】:

试试这个依赖,这个好像是最新的而不是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

【讨论】:

  • 不幸的是,这并没有什么区别。
  • 是的,我做到了,我在第一篇文章中包含了它。我试过了,它只会导致其他错误。但我就是不明白为什么一个全新的、未经改动的项目会出错。
【解决方案2】:

您是否尝试过删除 .m2 本地存储库?

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-05
    • 1970-01-01
    • 1970-01-01
    • 2021-12-18
    • 1970-01-01
    相关资源
    最近更新 更多