插件版本解决了两次,第二次解决了错误的版本



我正在尝试从源构建JIRA 6.0.7

https://confluence.atlassian.com/jira064/building-jira-from-source-720411927.html

它有JDK-8的构建问题,所以我不得不使用JDK-7。一个工件下载了最新的插件版本(尽管pom.xml中定义了显式版本),但由于类文件版本的原因而失败。

这是mvn -X package:的输出

[INFO] Scanning for projects...
[DEBUG] com.atlassian.maven.plugins:maven-jira-plugin:jar:4.1.5:
[DEBUG]    com.atlassian.maven.archetypes:jira-plugin-archetype:jar:4.1.5:runtime
[DEBUG]    com.atlassian.maven.plugins:maven-amps-plugin:jar:4.1.5:compile
...
[DEBUG]   Included: com.atlassian.maven.plugins:maven-amps-plugin:jar:4.1.5
...
[DEBUG] Resolving plugin version for com.atlassian.maven.plugins:maven-amps-plugin
[DEBUG] Could not find metadata com.atlassian.maven.plugins:maven-amps-plugin/maven-metadata.xml in local (C:m2repo)
[DEBUG] Skipped remote update check for com.atlassian.maven.plugins:maven-amps-plugin/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Skipped remote update check for com.atlassian.maven.plugins:maven-amps-plugin/maven-metadata.xml, locally cached metadata up-to-date.
[DEBUG] Resolved plugin version for com.atlassian.maven.plugins:maven-amps-plugin to 6.2.6 from repository atlassian-proxy (https://m2proxy.atlassian.com/repository/public, releases+snapshots)
...
Caused by: java.lang.UnsupportedClassVersionError: com/atlassian/maven/plugins/amps/osgi/ValidateTestManifestMojo : Unsupported major.minor version 52.0

以下是简化的pom来重现问题:

<?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>bar</groupId>
    <artifactId>foo</artifactId>
    <version>1.1.7</version>
    <packaging>atlassian-plugin</packaging>
    <name>foo</name>
    <description>foo</description>

<dependencies>
</dependencies>
    <repositories>
        <repository>
            <id>atlassian-proxy</id>
            <name>Atlassian Maven 2 Proxy</name>
            <url>https://m2proxy.atlassian.com/repository/public</url>
        </repository>
        <repository>
            <id>atlassian-contrib</id>
            <name>Atlassian Contrib Repository</name>
            <url>https://m2proxy.atlassian.com/contrib</url>
        </repository>
    </repositories>
    <pluginRepositories>
    <pluginRepository>
            <id>atlassian-proxy</id>
            <name>Atlassian Maven 2 Proxy</name>
            <url>https://m2proxy.atlassian.com/repository/public</url>
        </pluginRepository>
    </pluginRepositories>
    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>4.1.5</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
</project>

注意

maven-amps-plugin-4.1.5.jar是为java6:构建的

C:>javap -v -classpath maven-amps-plugin-4.1.5.jar com.atlassian.maven.plugins.amps.osgi.ValidateTestManifestMojo | find "major version"
  major version: 50

注2

我太绝望了,我现在正在调试maven代码。https://maven.apache.org/ref/3.3.1/xref/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.html#L90

在回落到resolveFromRepository()之前,它尝试resolveFromProject(),但失败了,因为request.pom == null。为什么?

project.getBuildPlugins()返回(众多)maven-amps-pluginversion == null。为什么?

project.getBuildPlugins().get(0)
    artifactId  "maven-jira-plugin" (id=489)    
    version "4.1.5" (id=498)    
project.getBuildPlugins().get(5)
    artifactId  "maven-amps-plugin" (id=402)    
    version null    

最初,在解析com/atlassian/amps/standalone/4.1.5/standalone-4.1.5.pom时会创建一个具有正确版本的Plugin对象,但随后会在DefaultLifecyclePluginAnalyzer.parseLifecyclePhaseDefinitions()中创建另一个实例。我想这是由<packaging>atlassian-plugin</packaging> 引起的

似乎maven-amps-plugin 4.1.5,maven-jira-plugin的依赖项是使用JDK 8构建的。我试着试用我能得到的版本,希望是以前的版本。奇怪的是,Maven Central的版本是2015年的5.0.18,所以我仔细考虑了一下,结果发现Oracle驱动程序有问题,这还可以(因为Oracle驱动程序,如果我没有弄错的话,没有存储在Central上)。您的本地存储库可能有它,这个片段可以帮助您。所以,即使这不太可能是你问题的正确解决方案,以防万一。

        <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>maven-jira-plugin</artifactId>
            <version>4.1.5</version>
            <extensions>true</extensions>
            <dependencies>
                <dependency>
                    <groupId>com.atlassian.maven.plugins</groupId>
                    <artifactId>maven-amps-plugin</artifactId>
                    <version>5.0.18</version>
                </dependency>
            </dependencies>
        </plugin>

相关内容

  • 没有找到相关文章

最新更新