jersey and jackson maven dependency issues? - jersey

I have just started building a web app using jersey and jackson. After initially getting up and running I decided that it made sense in the long run to convert the project to be a maven one. I'm very new to maven and it seems like I might have run into a dependency issue between jersey and jackson.
I put together a simple test to check that everything had been set up correctly after running into issues with some of my project tests that use jackson. The user object is based on the one in the jackson tutorial
#Test
public void testJacksonSetup() throws IOException {
String json = "{\"name\":{\"first\":\"Joe\",\"last\":\"Sixpack\"},\"verified\":false,\"gender\":\"MALE\",\"userImage\":\"Rm9vYmFyIQ==\"}";
ObjectMapper mapper = new ObjectMapper();
User user = mapper.readValue(json, User.class);
assertEquals("Joe", user.getName().getFirst());
Writer strWriter = new StringWriter();
mapper.writeValue(strWriter, user);
assertEquals(json, strWriter.toString());
}
which is throwing the following exception
org.codehaus.jackson.type.JavaType.isMapLikeType()Z
java.lang.NoSuchMethodError: org.codehaus.jackson.type.JavaType.isMapLikeType()Z
at org.codehaus.jackson.map.ser.BasicSerializerFactory.buildContainerSerializer(BasicSerializerFactory.java:396)
at org.codehaus.jackson.map.ser.BasicSerializerFactory.buildContainerSerializer(BasicSerializerFactory.java:396)
at org.codeh
I tried running the same test in a simple maven java application to make sure there weren't issues with the way I had set up the jackson dependencies and everything worked. I suspect the problem is caused by some dependency issue between jersey and jackson since it also uses jackson. I also suspect that way I cobbled have the pom file for my web app together could be problem. Here is the content of my pom with some slight naming changes (as I said before I'm new to using maven so I'd say this is a pretty ugly pom file)
<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>com.myproject.app</groupId>
<artifactId>app</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>
<groupId>com.myproject.app</groupId>
<version>${project.parent.version}</version>
<artifactId>my-web-app</artifactId>
<name>My web app</name>
<packaging>war</packaging>
<properties>
<netbeans.hint.deploy.server>gfv3</netbeans.hint.deploy.server>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jersey-version>1.8-SNAPSHOT</jersey-version>
</properties>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>com.myproject.app</groupId>
<artifactId>myproject-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey-version}</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>${jersey-version}</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>${jersey-version}</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly2</artifactId>
<version>${jersey-version}</version>
<scope>test</scope>
</dependency>
<!-- for external testing -->
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-external</artifactId>
<version>${jersey-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<finalName>mywebapp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>WEB-INF/glassfish-web.xml</packagingExcludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- Run the application using "mvn embedded-glassfish:run" -->
<plugin>
<groupId>org.glassfish</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>3.1</version>
<configuration>
<goalPrefix>embedded-glassfish</goalPrefix>
<app>${basedir}/target/mywebapp.war</app>
<autoDelete>true</autoDelete>
<port>8080</port>
</configuration>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.servlet</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.ejb</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.24</version>
<configuration>
<webApp>${basedir}/target/mywebapp.war</webApp>
<contextPath>treemetrics-api-01</contextPath>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xslt-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>update-gf-deps</id>
<phase>package</phase> <!-- append to the packaging phase. -->
<goals>
<goal>transform</goal> <!-- goals == mojos -->
</goals>
<configuration>
<xslFile>src/main/xslt/gf.xsl</xslFile>
<srcDir>.</srcDir>
<srcIncludes>pom.xml</srcIncludes>
<destDir>target/gf-pom-file</destDir>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</pluginRepository>
<pluginRepository>
<id>maven2-glassfish-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/glassfish/</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>glassfish-repository</id>
<name>Java.net Repository for Glassfish</name>
<url>http://download.java.net/maven/glassfish</url>
</repository>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
Does anyone know what is causing the issues with jackson and If there is a dependency issue with jersey and how to resolve it?

As already mentioned, this is probably a version conflict (error message does suggest that something is compiled against 1.8, but an earlier version is being used somehow).
One thing that I have noticed to cause issues is that versions of "core" and "mapper" jars may differ. In this case, for example, it sounds like mapper version 1.8 was being used, but core jar version was earlier. Although Jackson core jar does define proper version, Maven may not rely on that information but by version some other component mandates.
So whenever specifying dependency to Jackson from your own pom.xml, make sure that versions of core (jackson-asl-core) and mapper (jackson-ask-mapper) are both defined, and have same value (or at least same minor versions, 1.8.x).

I was having the same issue after I upgraded the datanucleus-hbase lib.
My solution was to include the two jackson libs:
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-hbase</artifactId>
<version>3.1.0-m1</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.4</version>
</dependency>

The jersey-json dependencies have its own jackson dependency.
For Jersey 1.8 its Jackson 1.7.1. So, start by removing the 1.8.1 and 1.8.2 dependencies, they may cause trouble. Maven is not deterministic: if it encounters two versions of the same dependency (with the same count), the chosen one cannot be predicted.
You don't have to create a JSON string neither to call Jackson mapper yourself. Take a look a this fully working/tested app I've post on GitHub. Hope it will help.

Related

How to add and artifact located at openhab repository with Maven?

I am looking to add a dependency to my pom.xml file
The dependency is a library allowing to manipulate Bluetooth Low Energy devices. Here is the link : TinyB
Here is also the github of the library : intel-iot-devkit/tinyb
When I copy and paste the snippet code to add the dependency, I get the following error after Maven tries to resolve the dependencies :
Could not find artifact intel-iot-devkit:tinyb:pom:0.5.1 in central (https://repo.maven.apache.org/maven2)
Could this be because the artifact is located in the OpenHab repository ? Then if this may cause the problem, how to solve it ?
Here is a copy of my pom.xml file :
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>org.HAcare</groupId>
<artifactId>HAcare_Connector</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>15.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>15.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/intel-iot-devkit/tinyb -->
<dependency>
<groupId>intel-iot-devkit</groupId>
<artifactId>tinyb</artifactId>
<version>0.5.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.6</version>
<executions>
<execution>
<!-- Default configuration for running -->
<!-- Usage: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>org.HAcare.App</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
And here is the code snippet I added to pom.xml :
<dependency>
<groupId>intel-iot-devkit</groupId>
<artifactId>tinyb</artifactId>
<version>0.5.1</version>
</dependency>
There is a second repository where it is possible to use this library by adding a dependency to the pom.xml file. Indeed it seems that the libraries are stored on the repository of openHAB.
To proceed you must first :
Add a repositories section in the pom.xml file
Here is a snippet code:
<repositories>
<repository>
<id>openHAB</id>
<name>openHabTinyB</name>
<url>https://openhab.jfrog.io/openhab/libs-release/</url>
</repository>
</repositories>
You have to add the following dependency:
Here is a snippet code:
<!-- https://mvnrepository.com/artifact/org.openhab.osgiify/intel-iot-devkit.tinyb -->
<dependency>
<groupId>org.openhab.osgiify</groupId>
<artifactId>intel-iot-devkit.tinyb</artifactId>
<version>0.5.1</version>
</dependency>

Using SoapUI maven plugin with GitLab - dependencies could not be resolved

I've been having some difficulties setting up my SoapUI test in Gitlab pipeline. At first I was successful getting them to run in principle. By now I've added my real tests into the project and got into some problems with JDBC steps. I have both Oracle and Postgres connections in my steps. Can some of you tell me what I'm doing wrong?
At first I was getting connection errors left and right. Then I realized I probably need to add dependencies. I added
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.8</version>
</dependency>
but nothing changed. I also added oracle driver but now I'm getting
[ERROR] Failed to execute goal com.smartbear.soapui:soapui-maven-plugin:5.5.0:test (default) on project dsa-otsusetugi-soapui-tests: Execution default of goal com.smartbear.soapui:soapui-maven-plugin:5.5.0:test failed: Plugin com.smartbear.soapui:soapui-maven-plugin:5.5.0 or one of its dependencies could not be resolved: Failed to collect dependencies at com.smartbear.soapui:soapui-maven-plugin:jar:5.5.0 -> com.oracle:ojdbc8:jar:12.2.0.1.0: Failed to read artifact descriptor for com.oracle:ojdbc8:jar:12.2.0.1.0: Could not transfer artifact com.oracle:ojdbc8:pom:12.2.0.1.0 from/to rmv_repo (http://repo.rmv/nexus/repository/maven-public/): Transfer failed for http://repo.rmv/nexus/repository/maven-public/com/oracle/ojdbc8/12.2.0.1.0/ojdbc8-12.2.0.1.0.pom: Unknown host repo.rmv: Name or service not known -> [Help 1]
What's interesting that I don't get any errors during the download phase..
https://pastebin.com/1HGXytJk
Currently my pom file containing dependencies looks like this:
<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>
<groupId>blaa.blaah</groupId>
<artifactId>blaa-blaah</artifactId>
<version>1.0-SNAPSHOT</version>
<name>BLAAHSoapUITests</name>
<properties>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.version>3.0.0</maven.version>
<soapui.version>5.5.0</soapui.version>
<surefire.version>2.20</surefire.version>
</properties>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://smartbearsoftware.com/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/test.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>${soapui.version}</version>
<configuration>
<soapuiProperties>
<property>
<name>soapui.logroot</name>
<value>${project.basedir}/build-testlog/build-testlog-</value>
</property>
</soapuiProperties>
<projectFile>${project.basedir}/${projectfile}</projectFile>
<projectProperties>
<value>END_POINT=${END_POINT}</value>
<value>USER_ID=${USER_ID}</value>
</projectProperties>
<outputFolder>${project.basedir}/build-testlog</outputFolder>
<printReport>true</printReport>
<junitReport>true</junitReport>
</configuration>
<dependencies>
<dependency>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui</artifactId>
<version>${soapui.version}</version>
<exclusions>
<exclusion>
<groupId>javafx</groupId>
<artifactId>jfxrt</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1.0</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.8</version>
</dependency>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>forms</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<outputDirectory>${project.basedir}/build/reports/html</outputDirectory>
</reporting>
Am I doing something wrong? Am I using wrong dependencies?
Thanks in advance.
If anyone is facing something similar then my problem, as it turned out, was that Gitlab runner didn't have permission to access the postgres database. It did get the driver, but couldn't connect due to security settings.
Anyhow I still had problems with oracle driver, since it's not publically in smartbear repo. What I did is that I added the driver locally with the help of this tutorial: https://gist.github.com/timmolderez/92bea7cc90201cd3273a07cf21d119eb
So in the end my pom looked something like this:
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>https://rapi.tools.ops.smartbear.io/nexus/content/groups/public/</url>
</pluginRepository>
<pluginRepository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/lib</url>
</pluginRepository>
</pluginRepositories>
and
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>6.0</version>
</dependency>
groupId, artifactId and version (also folder names and jar, pom files, of course) named like the tutorial said.

Unable to start jira - Unable to execute mojo exception

I am running JIRA 7.0.2 in my system and Atlassian SDK 6.1.2.
OS-Windows 7
I have my own plugins and when ever I try to run jira by atlas-debug I get this exception.
--- maven-jira-plugin:6.1.2:generate-manifest (default-generate-manifest) # jira-menu-items ---
Generating a manifest for this plugin
using maven-bundle-plugin v2.5.3
Manifest com.atlassian.plugins.tutorial:jira-menu-items:atlassian-plugin:1.1 : The default package '.' is not permitted by the Import-Package syntax.
This can be caused by compile errors in Eclipse because Eclipse creates
valid class files regardless of compile errors.
The following package(s) import from the default package null
Error(s) found in manifest configuration
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 2:32.854s
Finished at: Tue Nov 24 22:24:04 IST 2015
Final Memory: 66M/682M
------------------------------------------------------------------------
Failed to execute goal com.atlassian.maven.plugins:maven-jira-plugin:6.1.2:generate-manifest (default-generate-manifest) on project jira-menu-items: Unable to execute mojo: Error(s) found in manifest configuration -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
POM.XML
<?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>com.atlassian.plugins.tutorial</groupId>
<artifactId>jira-menu-items</artifactId>
<version>1.1</version>
<organization>
<name>Milind Company</name>
<url>http://www.milind.com/</url>
</organization>
<name>jira-menu-items</name>
<description>This is the com.atlassian.plugins.tutorial:jira-menu-items plugin for Atlassian JIRA.</description>
<packaging>atlassian-plugin</packaging>
<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
<!-- Add dependency on jira-core if you want access to JIRA implementation classes as well as the sanctioned API. -->
<!-- This is not normally recommended, but may be required eg when migrating a plugin originally developed against JIRA 4.x -->
<!--
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-core</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-runtime</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-amps-dispatcher-plugin</artifactId>
<version>5.0.18</version>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<!-- WIRED TEST RUNNER DEPENDENCIES -->
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>
<!-- Uncomment to use TestKit in your project. Details at https://bitbucket.org/atlassian/jira-testkit -->
<!-- You can read more about TestKit at https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Smarter+integration+testing+with+TestKit -->
<!--
<dependency>
<groupId>com.atlassian.jira.tests</groupId>
<artifactId>jira-testkit-client</artifactId>
<version>${testkit.version}</version>
<scope>test</scope>
</dependency>
-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<Export-Package>net.gisnas.jira.mailqueue.api,</Export-Package>
<Import-Package>org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional", *</Import-Package>
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>1.2.6</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>7.0.2</jira.version>
<amps.version>6.1.2</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.6</atlassian.spring.scanner.version>
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<!-- TestKit version 6.x for JIRA 6.x -->
<testkit.version>6.3.11</testkit.version>
</properties>
</project>
Settings.xml
<settings>
<localRepository>C:\Users\Milind\.m2\repository</localRepository>
<profiles>
<profile>
<id>atlassian-repositories</id>
<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>
</profile>
</profiles>
<activeProfiles>
<activeProfile>atlassian-repositories</activeProfile>
</activeProfiles>
</settings>
Try to clean up the target directory within your plugin directory or simply use command atlas-clean from plugin directory and run your plugin.
If you've made some changes in pom.xml then before running plugin, you should execute this command first atlas-mvn eclipse:eclipse. Every time you made changes in pom you should execute this command.
Please, check once that your JDK version is 8 because JIRA 7.x will only works with JDK 8.
You've set incompatible version for amps in dependency. Use 6.1.2 instead of 5.x
com.atlassian.maven.plugins
maven-amps-dispatcher-plugin
5.0.18
And if you are trying to debug the code in Eclipse after running JIRA from command then you should specify the port number to attach debugger. Your command will be like this atlas-debug --jvm -debug -port 5005.
Hope this will help you to resolve your problem.

"MojoExecutionException: Unable to execute mojo" while running atlas-cli pi command

I try to compile my custom jira plugin by running atlas-cli pi command.
It worked when I used repository http://repo1.maven.org/maven2/. Now it changed to http://search.maven.org/#browse%7C-1081192444
This is the text of error:
[ERROR] Unable to complete running command: pi
java.lang.RuntimeException: org.apache.maven.plugin.MojoExecutionException: Unab
le to execute mojo
at org.twdata.maven.cli.commands.ExecuteGoalCommand.run(ExecuteGoalComma
nd.java:112)
at org.twdata.maven.cli.commands.ExecuteGoalCommand.run(ExecuteGoalComma
nd.java:107)
at org.twdata.maven.cli.CliShell.interpretCommand(CliShell.java:48)
at org.twdata.maven.cli.CliShell.run(CliShell.java:29)
at org.twdata.maven.cli.AbstractCliMojo.displayShell(AbstractCliMojo.jav
a:170)
at org.twdata.maven.cli.AbstractCliMojo.access$000(AbstractCliMojo.java:
22)
Caused by: com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectExc
eption: Connection refused: connect
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle
(URLConnectionClientHandler.java:126)
at com.atlassian.maven.plugins.pdk.InstallPluginMojo$BasicAuthFilter.han
dle(InstallPluginMojo.java:425)
at com.sun.jersey.api.client.Client.handle(Client.java:365)
My version:
ATLAS Version: 4.2.20
ATLAS Home: C:\atlassian-plugin-sdk
ATLAS Scripts: C:\atlassian-plugin-sdk\bin
ATLAS Maven Home: C:\atlassian-plugin-sdk\apache-maven
--------
Executing: "C:\atlassian-plugin-sdk\apache-maven\bin\mvn.bat" --version -gs C:\a
tlassian-plugin-sdk\apache-maven/conf/settings.xml
Apache Maven 2.1.0 (r755702; 2009-03-18 22:10:27+0300)
Java version: 1.6.0_38
Java home: C:\Program Files\Java\jdk1.6.0_38\jre
Default locale: ru_RU, platform encoding: Cp1251
OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"
I've just found that it could be wrong version in pom.xml.
But when I wrote another version in pom.xml I got error:
ERROR] BUILD ERROR
[INFO] -----------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Please, can anyone help?
Repository in my settings.xml:
<pluginRepository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>maven-plugin-repo</id>
<url>hhttp://search.maven.org/#browse%7C-1081192444</url>
</pluginRepository>
My pom.xml:
<?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>com.atlassian.plugins.tutorial</groupId>
<artifactId>xproduct-admin-ui-plugin</artifactId>
<version>1.0</version>
<organization>
<name>Example Company</name>
<url>http://www.example.com/</url>
</organization>
<name>xproduct-admin-ui-plugin</name>
<description>This plugin has an admin UI that can be used in any Atlassian product.</description>
<packaging>atlassian-plugin</packaging>
<dependencies>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>2.0.16</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>6.0.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-core</artifactId>
<version>6.0.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<version>1.4.4-m1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-amps-plugin</artifactId>
<version>4.2.20</version>
<extensions>true</extensions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
com.atlassian.maven.plugins
</groupId>
<artifactId>
maven-jira-plugin
</artifactId>
<versionRange>
[4.2.10,)
</versionRange>
<goals>
<goal>
compress-resources
</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<properties>
<refapp.version>4.2.4</refapp.version>
</properties>
<repositories>
<repository>
<id>https-atlassian</id>
<url>https://maven.atlassian.com/repository/public/</url>
</repository>
</repositories>
</project>
Version 4.2.20 of the Atlassian Plugin SDK is only compatible with Maven 2.1.0 - so don't update Maven to 3.2.1. If you do update Maven, you'll need to update the Atlassian Plugin SDK to version 5.x as well.
As for your settings.xml, try removing it entirely. The Atlassian Plugin SDK comes bundled with a pre-configured settings.xml which has all the required configuration specified for you (it's in C:\a
tlassian-plugin-sdk\apache-maven\conf\settings.xml). If you need a custom settings.xml for other Maven development purposes, you will need to reconcile your settings with the ones shipped with the SDK and make sure you're not overriding anything incorrectly.
Repository in my settings.xml:
<pluginRepository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>maven-plugin-repo</id>
<url>hhttp://search.maven.org/#browse%7C-1081192444</url>
</pluginRepository>
You have a mistake hhttp://search.maven.org/#browse%7C-1081192444, it should be http://search.maven.org/#browse%7C-1081192444

maven-schemaspy-plugin doesn't work (maybe it's a repository issue)

I want to generate a er-diagram from a database integrated in the maven lifecycle.
SchemaSpy generates the er-diagram and with the maven-schemaspy-plugin it should be possible to integrate this in the lifecyle-process.
(If anyone has a better idea for this please let me know)
I tried it with the following simple pom.xml (which only should generate the er-diagram); but the plugin doesn't start; it couldn't even be downloaded:
<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>
<groupId>test.schemaspy</groupId>
<artifactId>SchemaSpyGenerateDB_02</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>SchemaSpyGenerateDB_02</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>maven-plugins</groupId>
<artifactId>maven-schemaspy-plugin</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>maven-plugins</groupId>
<artifactId>maven-schemaspy-plugin</artifactId>
<version>1.0</version>
<type>plugin</type>
</dependency>
</dependencies>
<!-- To use the report goals in your POM or parent POM -->
<reporting>
<plugins>
<plugin>
<groupId>maven-plugins</groupId>
<artifactId>maven-schemaspy-plugin</artifactId>
<version>1.1</version>
<configuration>
<databaseType>derby</databaseType>
<database>JPACertifiaction_Relationship</database>
<host>localhost</host>
<port>1527</port>
<user>user</user>
<password>password</password>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
The command
mvn site:site
causes the message
The POM for maven-plugins:maven-schemaspy-plugin:jar:1.0 is missing, no dependency information available
The POM for maven-plugins:maven-schemaspy-plugin:plugin:1.0 is missing, no dependency information available
I've also tried it with the following settings with no success:
<dependency>
<groupId>com.wakaleo.schemaspy</groupId>
<artifactId>maven-schemaspy-plugin</artifactId>
<version>5.0.1</version>
</dependency>
....
<reporting>
<plugins>
<plugin>
<groupId>com.wakaleo.schemaspy</groupId>
<artifactId>maven-schemaspy-plugin</artifactId>
<version>5.0.1</version>
....
<repository>
<id>Wakaleo Repository</id>
<url>http://maven.wakaleo.com/mojo/maven-schemaspy-plugin/</url>
</repository>
What me also confuses is that there are different reposititories with different versions 1.0 / 5.0.1 so what is really the official one ?
You don't need the entries
<dependencies>
<dependency>
<groupId>maven-plugins</groupId>
<artifactId>maven-schemaspy-plugin</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>maven-plugins</groupId>
<artifactId>maven-schemaspy-plugin</artifactId>
<version>1.0</version>
<type>plugin</type>
</dependency>
</dependencies>
delete them. When you define a plugin (plugin section later) it gots downloaded by maven automatically. Your error message says that 1.0 is missing, but your plugin is 1.1, so it doesn'T fit to your dependencies anyway.
The maven-schemaspy-plugin and the com.wakaleo.schemaspy plugin are different plugins from different authors. None of them is the "official schemaspy" maven plugin. I was only able to solve it with the wakaleo plugin (with maven 3). The other plugin seams not to be available any more.
With Maven 3 the site generation changed, see site generation in Maven 3. As mentioned in this blog entry you have to include the plugin in this way (note that the versioning has changed):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.1</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>com.wakaleo.schemaspy</groupId>
<artifactId>maven-schemaspy-plugin</artifactId>
<version>1.0.4</version>
<configuration>
<databaseType>derby</databaseType>
<database>JPACertifiaction_Relationship</database>
<host>localhost</host>
<port>1527</port>
<user>user</user>
<password>password</password>
</configuration>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
and you need the link to the repository:
<pluginRepositories>
<pluginRepository>
<id>Wakaleo Repository</id>
<url>http://www.wakaleo.com/maven/repos/</url>
</pluginRepository>
</pluginRepositories>
Then the plugin starts. The rest is up to you :-)

Resources