【问题标题】:Parent Version will get overriden by artifact version父版本将被工件版本覆盖
【发布时间】:2018-04-11 12:05:41
【问题描述】:

您好 Apache Wicket 和/或 Maven 大师,

我正在通过以下链接尝试使用 Springboot 的 Apache Wicket 示例: https://github.com/MarcGiffing/wicket-spring-boot-examples/tree/master/simple

所以我在 pom.xml 中所做的是这样的:

...
<modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.giffing.wicket.spring.boot.starter</groupId>
    <artifactId>wicket-spring-boot-starter-parent</artifactId>
    <!-- <version>1.0.12</version> -->
  </parent>

  <groupId>com.giffing</groupId>
  <artifactId>simple</artifactId>
  <version>0.0.1</version>
  <name>simple</name>

  <properties>
    <wicket.version>7.10.0</wicket.version>
  </properties>

...

会发生什么,它将在 HomePage.java 中进行导入: 导入 com.giffing.wicket.spring.boot.context.scan.WicketHomePage;

未知。

具体的错误是: 描述 资源路径 位置 类型 import com.giffing.wicket.spring.boot.context 无法解析 HomePage.java /simple/src/main/java/com/giffing/examples/wicket/spring/boot/simple 第8行Java问题

您的专业知识将在这里受到高度赞赏。

谢谢,
阿塔尼斯

【问题讨论】:

    标签: java maven spring-boot wicket


    【解决方案1】:

    您需要使用 wicket-spring-boot-starter-parent:1.0.10。这是 Wicket 7.x 的最新版本:http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.giffing.wicket.spring.boot.starter%22%20AND%20a%3A%22wicket-spring-boot-starter-parent%22。 2.x 用于 Wicket 8.x。

    你可以在你的项目中使用mvn dependency:tree来查看Wicket、Spring Boot、Spring实际解析了哪些版本。

    如果这没有帮助,请提供更多 pom.xml 和更多关于错误的信息。

    【讨论】:

    • 感谢您的意见,马丁。我很感激。但不幸的是,它不起作用。不知何故,它将 wicket-spring-boot-starter-parent 的版本覆盖为 0.0.1 而不是 1.0.12。
    • 请分享完整的 pom.xml,以便我们为您提供更多帮助。
    • 请在@martin-g下方查看我的答案。谢谢。
    【解决方案2】:

    显然,我在这里使用的带有 spring boot 示例的 apache-wicket 可能存在一些问题。欲了解更多信息,这里是链接: https://github.com/MarcGiffing/wicket-spring-boot-examples/issues/2

    但是这个 pom.xml 适用于我的简单 apache-wicket 与 springboot 集成项目。

    <?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>
      <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
      </parent>
    
      <groupId>com.artanis</groupId>
      <artifactId>WicketSpringboot</artifactId>
      <version>0.0.1</version>
    
      <name>WicketSpringboot</name>
      <description></description>
      <url>http://www.example.com</url>
    
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    
        <!-- maven generated -->
        <maven-clean-plugin.version>3.0.0</maven-clean-plugin.version>
        <maven-resources-plugin.version>3.0.2</maven-resources-plugin.version>
        <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
        <maven-surefire-plugin.version>2.20.1</maven-surefire-plugin.version>
        <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
        <maven-install-plugin.version>2.5.2</maven-install-plugin.version>
        <maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
    
        <!-- Wicket Springboot -->
        <wicket-spring-boot-starter.version>2.1.0</wicket-spring-boot-starter.version>
    
        <!-- Wicket -->
        <wicket.version>8.0.0-M9</wicket.version>
      </properties>
    
      <dependencies>
        <!-- Springboot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    
        <!-- Wicket Springboot -->
        <dependency>
            <groupId>com.giffing.wicket.spring.boot.starter</groupId>
            <artifactId>wicket-spring-boot-context</artifactId>
            <version>${wicket-spring-boot-starter.version}</version>
        </dependency>
        <dependency>
            <groupId>com.giffing.wicket.spring.boot.starter</groupId>
            <artifactId>wicket-spring-boot-starter</artifactId>
            <version>${wicket-spring-boot-starter.version}</version>
        </dependency>
    
        <!-- Wicket -->
        <dependency>
            <groupId>org.wicketstuff</groupId>
            <artifactId>wicketstuff-annotation</artifactId>
            <version>${wicket.version}</version>
        </dependency>
    
        <!-- slf4j-log4j -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>
    
        <!-- JUnit -->
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <!-- <version>4.11</version> -->
          <scope>test</scope>
        </dependency>
      </dependencies>
    
      <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>
            </plugin>
        </plugins>
    
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <!-- <resource>
                <directory>src/main/resources/pages</directory>
            </resource> -->
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**</include>
                </includes>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>
    
        <!-- maven generated -->
        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
          <plugins>
            <plugin>
              <artifactId>maven-clean-plugin</artifactId>
              <version>${maven-clean-plugin.version}</version>
            </plugin>
            <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
            <plugin>
              <artifactId>maven-resources-plugin</artifactId>
              <version>${maven-resources-plugin.version}</version>
            </plugin>
            <plugin>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>${maven-compiler-plugin.version}</version>
            </plugin>
            <plugin>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>${maven-surefire-plugin.version}</version>
            </plugin>
            <plugin>
              <artifactId>maven-jar-plugin</artifactId>
              <version>${maven-jar-plugin.version}</version>
            </plugin>
            <plugin>
              <artifactId>maven-install-plugin</artifactId>
              <version>${maven-install-plugin.version}</version>
            </plugin>
            <plugin>
              <artifactId>maven-deploy-plugin</artifactId>
              <version>${maven-deploy-plugin.version}</version>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </project>
    

    谢谢,
    阿塔尼斯

    【讨论】:

      猜你喜欢
      • 2019-02-07
      • 1970-01-01
      • 2020-08-28
      • 1970-01-01
      • 2013-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-15
      相关资源
      最近更新 更多