2017-08-29 137 views
1

我在pom.xml文件中遇到問題。有誰知道做錯了什麼?pom.xml中的多個標記/預期標記問題

<?xml version="1.0" encoding="UTF-8"?> 
< 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.example</groupId> 
    <artifactId>demo</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.5.6.RELEASE</version> 
    </parent> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <java.version>1.8</java.version> 
     <junit.jupiter.version>5.0.0-M3</junit.jupiter.version> 
     <junit.vintage.version>${junit.version}.0-M3</junit.vintage.version> 
     <junit.platform.version>1.0.0-M3</junit.platform.version> 
     <cucumber.version>1.2.5</cucumber.version> 
     <mysql.connector.version>6.0.5</mysql.connector.version> 
     <jooq.verson>3.9.1</jooq.verson> 
    </properties> 

    <plugin> 
     <plugins> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.1</version> 
       <configuration> 
       <source>${java.version}</source> 
        <target>${java.version}</target> 
       </configuration> 
      </plugin> 
     </plugins> 

     <artifactId>maven-surefire-plugin</artifactId> 
     <version>2.19.1</version> 
     <configuration> 
     <include> 
     <include>**/Test*.java</include> 
      <include>**/*Test.java</include> 
      <include>**/*Tests.java</include> 
      <include>**/*TestCase.java</include> 
      <include>**/*Runner.java</include> 
     </include> 
     </configuration> 

     <dependencies> 
     <dependency> 
      <groupId>org.junit.platform</groupId> 
      <artifactId>junit-platform-surefire-provider</artifactId> 
      <version>LATEST</version> 
     </dependency> 

      <dependency> 
       <groupId>org.junit.jupiter</groupId> 
       <artifactId>junit-jupiter-engine</artifactId> 
       <version>LATEST</version> 
      </dependency> 
      <dependency> 
       <groupId>org.junit.vintage</groupId> 
       <artifactId>junit-vintage-engine</artifactId> 
       <version>${junit.jupiter.version}</version> 
      </dependency> 
     </dependencies> 
    </plugin> 

<plugin> 
<groupId>org.springframework.boot</groupId> 
<artifactId>spring-boot-maven-plugin</artifactId> 
</plugin> 

<plugin> 
<groupId>org.liquidbase</groupId> 
<artifactId>liduidbase</artifactId> 
<version>3.0.5</version> 
</plugin> 

<configuration> 

<driver>com.mysql.cj.jdbc.Driver</driver> 
<url>jdbc:mysql://127.0.0.1:33306/monster_app?nullNamePatternMatchesAll=true</url> 
<username>monster_user</username> 
<password>monster_password</password> 
<changeLogFile>src/main/java/com/example/changelog-master.xml</changeLogFile> 
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase> 
</configuration> 
<executions> 
<execution> 
    <phase>process-resources</phase> 
    <goals> 
     <goal>update</goal> 
    </goals> 
</execution> 
</executions> 
     </plugin> 
<groupId>org.jooq</groupId> 
<artifactId>jooq-codegen-maven</artifactId> 
<configuration> 
<jdbc> 
<driver>com.mysqk.cj.jdbc.Driver</driver> 
    <url>jdbc:mysql://127.0.0.1:33306/monster_app?nullNamePatternMatchesAll=true</url> 
    <username>monster_user</username> 
    <password>monster_password</password> 
</jdbc> 
<generator> 
    <name>org.jooq.util.JavaGenerator</name> 
    <database> 
    <name>org.jooq.util.mysql.MySQLDatabase</name> 
    <inputSchema>monster_app</inputSchema> 
    <includes>.*</includes> 
    </database> 

    <target> 

    <packageName>com.example.Generated</packageName> 
     <directory>src/main/java</directory> 
    </target> 
</generator> 
</configuration> 

<dependencies> 
<dependency> 
<groupId>org.junit.jupiter</groupId> 
    <version>${junit.jupiter.version}</version> 
    <scope>test</scope> 

</dependency> 

<dependency> 
<groupId>junit</groupId> 
    <artifactId>junit</artifactId> 
    <version>${junit.version}</version> 
    <scope>test</scope> 
</dependency> 

</dependencies> 

<repositories> 
<repository> 
<id>sonatype-snapshots</id> 
<url>https://oss.sonatype.org/content/repositories/snapshots</url> 
<snapshots> 
    <enabled>true</enabled> 
</snapshots> 
</repository> 
</repositories> 

<dependencies> 

<dependency> 
<groupId>info.cukes</groupId> 
<artifactId>cucumber-junit</artifactId> 
<version>${cucumber.version}</version> 
<scope>test</scope> 
</dependency> 

<dependency> 
<groupId>info.cukes</groupId> 
<artifactId>cucumber-java8</artifactId> 
<version>${cucumber.version</version> 
<scope>test</scope> 
</dependency> 

<dependency> 
<groupId>info.cukes</groupId> 
<artifactId>cucumber-jvm</artifactId> 
<version>1.0.11</version> 
<type>pom</type> 
</dependency> 

<dependency> 
<groupId>org.springframework.boot</groupId> 
<artifactId>spring-boot-starter-web</artifactId> 
</dependency> 


<dependency> 
<groupId>info.cukes</groupId> 
<artifactId>cucumber-spring</artifactId> 
<version>1.2.5</version> 
<scope>test</scope> 
</dependency> 

<dependency> 
<groupId>com.h2database</groupId> 
<artifactId>h2</artifactId> 
<scope>runtime</scope> 
</dependency> 

<dependency> 
<groupId>mysql</groupId> 
    <artifactId>mysql-connector-java</artifactId> 
    <version>${mysql.connector.version}</version> 
</dependency> 


<dependency> 
<groupId>org.springframework.boot</groupId> 
<artifactId>spring-boot-starter-test</artifactId> 
<scope>test</scope> 
</dependency> 

<dependency> 
<groupId>org.jooq</groupId> 
    <artifactId>jooq</artifactId> 
    <version>${jooq.version}</version> 
</dependency> 

<dependency> 
    <groupId>org.jooq</groupId> 
    <artifactId>jooq-meta</artifactId> 
<version>${jooq.version}</version> 
</dependency> 
<dependency> 
<artifactId>org.jooq</artifactId> 
    <groupId>jooq-codegen</groupId> 
    <version>${jooq.version}</version> 
</dependency> 

<dependency> 
<groupId>org.codehaus.jackson</groupId> 
    <artifactId>jackson-mapper-asl</artifactId> 
    <version>1.9.13</version> 
</dependency> 

<dependency> 
<groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-jdbc</artifactId> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-test</artifactId> 
    <version>4.3.10.RELEASE</version> 
    <scope>test</scope> 
</dependency> 

<dependency> 
<groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-test</artifactId> 
    <version>1.5.6.RELEASE</version> 
    <scope>test</scope> 
</dependency> 


<dependency> 
<groupId>junit</groupId> 
    <artifactId>junit</artifactId> 
    <version>4.12</version> 
</dependency> 

</dependencies> 
</project> 

我弄不清楚什麼是做錯了。前3行給我多個標籤錯誤,最後一行給我意想不到的標記。

此代碼已在其他人機器上嘗試過,它似乎工作正常。 我不認爲我有什麼奇怪的,但它仍然不適合我。

回答

2

您只是缺少project標籤名稱。

<?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"> 
0

有在你的pom.xml出現多重結構的問題,讓我在下面列出了幾個人:

  1. 第二行應以項目爲標籤,就像這樣:

    http://maven.apache.org/xsd/maven-4.0.0.xsd「>

  2. 應該駐留在標籤內,所有的標籤都應該 然後駐留在標籤內。

  3. 標籤應該位於特定標籤內。

我的建議是,如果您使用的是Eclipse等IDE,請鍵入Ctrl + Space來顯示每個標記的建議。這將幫助您將標籤移動到相關部分。此外,您應該保留該部分之上的所有依賴關係。