2016-04-08 8 views
0

Açık vardiya kullanmayı denerim. Ve openshift tomcat 7 içinde openshift eklentisi yardımı ile eclipse dinamik web projesi dağıtmak deneyin. Ve ben bina hatası, maven kötü ama anladım gibi maven benim web.xml görmüyorum ama benim var web.xml. Projenin bazı egzotik api yok. Benim WebContent/WEB-INF/web.xml geçerli:maven webxml özniteliği hatası gerekiyor, ancak web xml'im var mı?

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
    id="WebApp_ID" version="3.0"> 
    <display-name>Test</display-name> 
    <welcome-file-list> 
     <welcome-file>index.html</welcome-file> 
     <welcome-file>index.htm</welcome-file> 
     <welcome-file>index.jsp</welcome-file> 
     <welcome-file>default.html</welcome-file> 
     <welcome-file>default.htm</welcome-file> 
     <welcome-file>default.jsp</welcome-file> 
    </welcome-file-list> 
</web-app> 

i inşa çalıştığınızda i var:

[INFO] BUILD FAILURE 
[INFO] --------------------------------------------------------------------- 
[INFO] Total time: 3.525s 
[INFO] Finished at: Fri Apr 08 14:01:52 EDT 2016 
[INFO] Final Memory: 8M/111M 
[INFO] --------------------------------------------------------------------- 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project mywebtestproject: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) 

[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 
An error occurred executing 'gear postreceive' (exit code: 1) 
Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/5707e54c2d52712b110000cf/jbossews 

ve

<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>mywebtestproject</groupId> 
    <artifactId>mywebtestproject</artifactId> 
    <packaging>war</packaging> 
    <version>1.0</version> 
    <name>mywebtestproject</name> 
    <repositories> 
     <repository> 
      <id>eap</id> 
      <url>http://maven.repository.redhat.com/techpreview/all</url> 
      <releases> 
       <enabled>true</enabled> 
      </releases> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </repository> 
    </repositories> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>eap</id> 
      <url>http://maven.repository.redhat.com/techpreview/all</url> 
      <releases> 
       <enabled>true</enabled> 
      </releases> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </pluginRepository> 
    </pluginRepositories> 
    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <maven.compiler.source>1.6</maven.compiler.source> 
     <maven.compiler.target>1.6</maven.compiler.target> 
    </properties> 
    <dependencies> 
     <dependency> 
      <groupId>org.postgresql</groupId> 
      <artifactId>postgresql</artifactId> 
      <version>9.2-1003-jdbc4</version> 
     </dependency> 
     <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
      <version>5.1.25</version> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>javax.servlet-api</artifactId> 
      <version>3.0.1</version> 
      <scope>provided</scope> 
     </dependency> 
    </dependencies> 
    <profiles> 
     <profile> 
      <!-- When built in OpenShift the 'openshift' profile will be used when 
       invoking mvn. --> 
      <!-- Use this profile for any OpenShift specific customization your app 
       will need. --> 
      <!-- By default that is to put the resulting archive into the 'webapps' 
       folder. --> 
      <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html --> 
      <id>openshift</id> 
      <build> 
       <finalName>mywebtestproject</finalName> 
       <plugins> 
        <plugin> 
         <artifactId>maven-war-plugin</artifactId> 
         <version>2.1.1</version> 
         <configuration> 
          <outputDirectory>webapps</outputDirectory> 
          <warName>ROOT</warName> 
         </configuration> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
    </profiles> 
</project> 
+1

1. Eklenti web.xml dosyasını bulamıyor. Proje klasör yapısını gösterir. 2. Neden maven-war-plugin 2.1.1 versiyonunu seçtiniz, 5 yaşında – michaldo

cevap

0

mü benim pom.xml olduğunu Bunu pom.xml'inize koymayı denediniz mi? <webXml> etiketini ekleyin.

 <build> 
      <finalName>mywebtestproject</finalName> 
      <plugins> 
       <plugin> 
        <artifactId>maven-war-plugin</artifactId> 
        <version>2.1.1</version> 
        <configuration> 
         <outputDirectory>webapps</outputDirectory> 
         <warName>ROOT</warName> 
         <webXml>src/main/webapp/WEB-INF/web.xml</webXml> 
        </configuration> 
      </plugin> 
     </plugins> 
    </build> 
+0

konfigürasyonda ** ** etiketini içerir. – ffSouza

+0

Eğer öyleyse evet, ama geri eğik çizgi kullanmayın .... ve maven-savaş eklentisinin daha güncel versiyonunu kullanın https://maven.apache.org/plugins/maven-war-plugin/ – khmarbaise

İlgili konular