I'm trying to build JIRA 6.0.7
from source
https://confluence.atlassian.com/jira064/building-jira-from-source-720411927.html
It had build issues with JDK-8
so I had to use JDK-7
. One artifact downloads latest plugin version (although explicit version is defined in pom.xml) and fails, because of class file version.
Here's the output of 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
Here's simplified pom to reproduce the problem:
<?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>
Note
maven-amps-plugin-4.1.5.jar
is built for java 6:
C:\>javap -v -classpath maven-amps-plugin-4.1.5.jar com.atlassian.maven.plugins.amps.osgi.ValidateTestManifestMojo | find "major version"
major version: 50
Note2
I'm so desperate, I'm now debugging maven code. https://maven.apache.org/ref/3.3.1/xref/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.html#L90
Before falling back to resolveFromRepository()
it tries to resolveFromProject()
, but fails, because request.pom == null
. Why?
project.getBuildPlugins() returns (among many) maven-amps-plugin
with version == null
. Why?
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
Initially, a Plugin
object is created with correct version while parsing com/atlassian/amps/standalone/4.1.5/standalone-4.1.5.pom
, but then another instance created in DefaultLifecyclePluginAnalyzer.parseLifecyclePhaseDefinitions()
. I guess it's caused by <packaging>atlassian-plugin</packaging>