2017-02-18 60 views
0

使用Eclipse Mars.2 4.5.2 Maven构建成功。在部署过程中,我得到以下错误:Maven构建工程,部署期间获取类未找到

抛出java.lang.ClassNotFoundException:com.authy.AuthyApiClient从[模块\ “deployment.mavenFlowChartDB5.war:主要\” 从服务模块加载]“}}

在Maven的依赖目录我看到了相关的依赖与依赖项下的类。

库> Maven依赖> authy-java的1.1.0.jar> com.auth.AuthyApiCLient

为什么没有部署看到这个缺失的类?

<?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.mycompany</groupId> 
     <artifactId>mavenFlowChartDB5</artifactId> 
     <version>1.0-SNAPSHOT</version> 
    <packaging>war</packaging> 

    <name>mavenFlowChartDB5</name> 

    <properties> 
     <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.primefaces</groupId> 
      <artifactId>primefaces</artifactId> 
      <version>6.0</version> 
     </dependency> 

     <dependency> 
      <groupId>commons-fileupload</groupId> 
      <artifactId>commons-fileupload</artifactId> 
      <version>1.3</version> 
     </dependency> 
     <dependency> 
      <groupId>commons-io</groupId> 
      <artifactId>commons-io</artifactId> 
      <version>2.4</version> 
     </dependency> 

     <dependency> 
      <groupId>org.apache.httpcomponents</groupId> 
      <artifactId>httpclient</artifactId> 
      <version>4.5.1</version> 
     </dependency> 

     <dependency> 
      <groupId>org.eclipse.persistence</groupId> 
      <artifactId>eclipselink</artifactId> 
      <version>2.5.1</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.eclipse.persistence</groupId> 
      <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId> 
      <version>2.5.1</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>javax</groupId> 
      <artifactId>javaee-web-api</artifactId> 
      <version>7.0</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
    <groupId>org.postgresql</groupId> 
    <artifactId>postgresql</artifactId> 
    <version>9.2-1002-jdbc4</version> 
</dependency> 
<dependency> 
    <groupId>com.amazonaws</groupId> 
    <artifactId>aws-java-sdk</artifactId> 
    <version>1.8.2</version> 
</dependency> 
<dependency> 
    <groupId>org.jboss.ejb3</groupId> 
    <artifactId>jboss-ejb3-ext-api</artifactId> 
    <version>2.1.0</version> 
</dependency> 
     <dependency> 
      <groupId>com.authy</groupId> 
      <artifactId>authy-java</artifactId> 
      <version>1.1.0</version> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.1</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
        <compilerArguments> 
         <endorseddirs>${endorsed.dir}</endorseddirs> 
        </compilerArguments> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.3</version> 
       <configuration> 
        <failOnMissingWebXml>false</failOnMissingWebXml> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-dependency-plugin</artifactId> 
       <version>2.6</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>7.0</version> 
            <type>jar</type> 
           </artifactItem> 
          </artifactItems> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 
    <repositories> 
     <repository> 
      <url>http://repository.primefaces.org/</url> 
      <id>PrimeFaces-maven-lib</id> 
      <layout>default</layout> 
      <name>Repository for library PrimeFaces-maven-lib</name> 
     </repository> 
     <repository> 
      <id>jboss-public-repository-group</id> 
      <name>JBoss Public Maven Repository Group</name> 
      <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url> 
      <layout>default</layout> 
      <releases> 
      <enabled>true</enabled> 
      <updatePolicy>never</updatePolicy> 
      </releases> 
      <snapshots> 
      <enabled>true</enabled> 
      <updatePolicy>never</updatePolicy> 
      </snapshots> 
     </repository> 
     </repositories> 
     <pluginRepositories> 
     <pluginRepository> 
      <id>jboss-public-repository-group</id> 
      <name>JBoss Public Maven Repository Group</name> 
      <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url> 
      <layout>default</layout> 
      <releases> 
      <enabled>true</enabled> 
      <updatePolicy>never</updatePolicy> 
      </releases> 
      <snapshots> 
      <enabled>true</enabled> 
      <updatePolicy>never</updatePolicy> 
      </snapshots> 
     </pluginRepository> 
     </pluginRepositories> 
</project> 

这是更新后的pom.xml。我仍然得到同样的错误。我注意到maven-compiler-plugin重复了几次。我添加了这部分。

<manifest> 
          <addClasspath>true</addClasspath> 
         </manifest> 

<build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.1</version> 
       <configuration> 
        <archive> 
         <manifest> 
          <addClasspath>true</addClasspath> 
         </manifest> 
        </archive> 
        <source>1.8</source> 
        <target>1.8</target> 
        <compilerArguments> 
         <endorseddirs>${endorsed.dir}</endorseddirs> 
        </compilerArguments> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.3</version> 
       <configuration> 
        <failOnMissingWebXml>false</failOnMissingWebXml> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-dependency-plugin</artifactId> 
       <version>2.6</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>7.0</version> 
            <type>jar</type> 
           </artifactItem> 
          </artifactItems> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 
+0

可以请你提供你的pom.xml吗? –

+0

您是从Eclipse部署的吗?如果不是那么如何? –

+0

是的,我正在从Eclipse进行部署。 – Android

回答

0

这可能是因为您没有在清单中为mavenFlowChartDB5战争添加classpath条目。您可以尝试使用this文档添加该文件。

+0

我加入了以下内容: true Android