Making jar files (jira plugin) - java

I'm making plugin for Jira and found new problem. When I'm making .jar file - my PC makes it in a wrong way. At the same time, PC of my co-worker makes everithing perfect from the same source. What can be the problem? JDK version or Atlassian SDK? Or something else?
here is 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.my_Plugin</groupId>
<artifactId>my_Plugin</artifactId>
<version>1.1.2</version>
<organization>
<name>Example company</name>
<url>http://example.com</url>
</organization>
<name>SmartAct</name>
<description>This 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>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-core</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.activeobjects</groupId>
<artifactId>activeobjects-plugin</artifactId>
<version>0.19.16</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</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>
<log4jProperties>src/log4j.properties</log4jProperties>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>6.0.4</jira.version>
<amps.version>4.2.3</amps.version>
</properties>
<repositories>
<repository>
<id>saucelabs</id>
<url>http://repository-saucelabs.forge.cloudbees.com/release</url>
</repository>
<repository>
<id>atlassian maven1</id>
<url>https://maven.atlassian.com/maven1</url>
</repository>
<repository>
<id>atlassian old</id>
<url>https://maven.atlassian.com/content/groups/public</url>
</repository>
<repository>
<id>atlassian-public</id>
<url>https://m2proxy.atlassian.com/repository/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>atlassian-public</id>
<url>https://m2proxy.atlassian.com/repository/public</url>
</pluginRepository>
</pluginRepositories>

The shown pom.xml does not contain the closing tag, copy and paste mistake?
Never tried repository and pluginRepository inside my pom.xml, I always use the ~/.m2/settings.xml; are your url's reachable?
Does atlas-mvn dependency:tree list all jars or are sume "gone missing"?
Are you compiling manually or from within Eclipse/Netbeans/IntelliJ...? Mind you, the IDEs usually com with an (incompatible) Maven(3) version that breaks while compiling atlassian plugins 95% of the time. To be absolutely sure, run manually from the shell.
Your 'PC' might just have the wrong encoding. Usually Maven tells you while compiling what encoding it uses, UTF-8/ISO-8859-x/CP-1252/whatever and that this is platform dependant. Atlassian products (generally) require UTF-8 for everything. The message looks like this: [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
Last, but not least, please try to build only for JIRA 6.0 not 6.0.4.
If possible, post the messages from you atlas-package command so we can try to guess what might be wrong. Please also specify your development environment, IDE/OS/Encoding of Shell, and your target platform, i.e. JIRA 6.0.4 under Windows x64or whatever.
Regards, Holger
#Paul: BTW: this has nothing todo with Running from inside Eclipse, you need a JIRA instance for those type of plugins, see here: Atlassian JIRA

Related

"swagger-codegen-maven-plugin:3.0.0 or one of its dependencies could not be resolved"

UPDATE: I see on this URL https://repo1.maven.org/maven2/io/swagger/swagger-codegen-maven-plugin/
that the only version of swagger codegen is 3.0.0-rc1
I'm trying to build a REST API with Java/SpringBoot and using the swagger-codegen plugin. I am able to use the plugin version of swagger codegen 2.3.1, it downloads fine for some reason.
However, I am trying to use Open api spec 3.0, and 2.3.1 would NOT work, and I found on Stackoverflow people saying I need to use 3.X.X of swagger-codegen to use open api spec 3.0.
So I changed the plugin version to 3.0.0, and 3.0.25 and many different versions but it keeps failing no matter what I do:
[ERROR] Plugin io.swagger:swagger-codegen-maven-plugin:3.0.0 or one of its dependencies could not be resolved: Could not find artifact io.swagger:swagger-codegen-maven-plugin:jar:3.0.0 in central (https://repo1.maven.org/maven2) -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin io.swagger:swagger-codegen-maven-plugin:3.0.0 or one of its dependencies could not be resolved: Could not find artifact io.swagger:swagger-codegen-maven-plugin:jar:3.0.0 in central (https://repo1.maven.org/maven2)
I was playing around with my settings.xml file and pom.xml but nothing seems to work. I'm confused because this JAR is on maven central, so it should be easily downloaded, correct? Also, I tried adding it as both a dependency AND plugin, and the dependency seems to be downloaded fine (even version 3.0.25), its just the plugin that fails all the time.
I will say I'm on a work computer being a proxy, but I added that info to the settings.xml - could that be related?
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 https://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.4.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mydomain.me</groupId>
<artifactId>my-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>My API</name>
<description>Version 2.0 of my API</description>
<properties>
<java.version>11</java.version>
</properties>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Maven Central</name>
<layout>default</layout>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-cli</artifactId>
<version>3.0.25</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.25</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/api.yaml</inputSpec>
<output>${project.basedir}/target/generated-sources</output>
<language>java</language>
<configOptions>
<sourceFolder>src/gen/java/main</sourceFolder>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I don't know if it helps, but I was facing a similar problem. The thing is that the dependency was downloaded to the .m2 folder, but it was not reflecting on Maven Dependencies inside Libraries in Eclipse. So I ran this command inside the project where I needed the plugin: mvn swagger-codegen:generate. And then the files I needed were generated. I have no idea why the plugin wasn't being showed in Eclipse, but somehow it was there, hidden.
The groupId of swagger-codegen-maven-plugin has changed. Should be:
<plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.35</version>
<plugin>

Error parsing lifecycle processing instructions

Below is my pom.xml file. On the very first line, I am getting an error of
Error parsing lifecycle processing instructions.
I need help finding what caused the error.
<?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>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>First</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
This issue was driving me insane, I've finally managed to solve it by deleting the whole maven repository located in:
Windows: c:\Users\<username>\.m2\
After that I just updated the project (Alt+F5 in Eclipse). Issue gone!
Maybe a clash of different versions of Maven (I use several different versions of Eclipse + m2e plugins).
There is some dependency got corrupted into .m2 folder.
You need to delete that dependency from .m2 folder.
If you are not able to find which one is corrupted then delete all
the dependency which are declared into pom.xml file.
It is due to an older version of m2e-wtp integration plugin. To resolve the issue, in Eclipse(Neon) you can go to Help --> Install New Software.. --> Enter http://download.eclipse.org/m2e-wtp/milestones/neon/1.3/ in the Work with box and press enter. Tick all the checkboxes, install the plugins and restart the IDE. It should work. Similarly, for other versions, you might refer the following link https://www.eclipse.org/m2e-wtp/ and try the latest/previous builds depending on your Eclipse version.
Take a look at eclipse web
http://marketplace.eclipse.org/content/maven-integration-eclipse-wtp
The m2eclipse-wtp project has moved to the Eclipse Foundation. The m2eclipse-wtp plugin is now deprecated in favor of the newer m2e-wtp
Automatic installation from the marketplace has been suspended. m2eclipse-wtp 0.15.3 can be manually installed from http://download.jboss.org/jbosstools/updates/m2eclipse-wtp/
You need to first uninstall all m2e-wtp plugins in Eclipse, then install them from jboss url
No need to clean .m2 folder, I fixed this issue by adding corresponding maven to eclipse
Inspite of adding the new path and making changes to the user settings the error "Error parsing lifecycle processing instructions" persists. I restarted the server. Is there any other change required?
This same problem happened to me.
I'm using the new Eclipse Neon. Maybe it's an issue related to the Maven version included in this new release.
I have solved it by using Gradle instead of Maven.
Note: you can try to use Maven with the previous version of Eclipse.
Try this, it might be helpful.
<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>com.demo</groupId>
<artifactId>test1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<java-version>1.8</java-version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>HelloWorld</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<warName>SpringWebExample</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
In my case the same issue was due to different version of maven. One which I installed manualy and other one which came Embedded with STS.
I resolved this issue using below steps:
1. Deleted .M2 folder (c:\Users\.m2)
Downloaded exact version of maven which is embedded with STS and configured same in env. variables and path variable.
STS Embedded maven- Image
Updated projects (Right click on project -> Maven -> Update Project...)
It took some time in update step as all dependencies downloaded again in .M2 folder. Finally issue is resolved.
I suffered the same problem in several projects of my workspace, the ones who belonged to the same parent. I have just one Maven version installed, and my local .m2 repository is working fine for a bunch of other maven projects in my wokspace.
In my case, the cause was a simple XML syntax error in the parent pom. I fixed it, refreshed the affected maven projects, and it went OK.
Before I made modifications to the .xml I made a copy in the same folder. After making my mods I began having issues.
Moving the backup out of the .m2 folder resolved the issue for me.

Cannot update/download dependencies of Maven project

I am trying to build this project in my eclipse. For this, I installed m2eclipse, and now I apparently need to update the dependencies via Maven.
Unfortunately, the "Update dependencies" doesn't run through. It just givesme this error in the projects pom.xml file:
Project build error:
Non-readable POM
C:\Users\flopes\.m2\repository\org\jenkins-ci\plugins\plugin\1.609.1\plugin-1.609.1.pom:
C:\Users\flopes\.m2\repository\org\jenkins-ci\plugins\plugin\1.609.1\plugin-1.609.1.pom
(System cannot find the file)
pom.xml
What is going on here? I looked into the referenced folder and these are the files present in there:
_maven.repositories
plugin-1.609.1.pom.ahc94dc028e8dc945b5
plugin-1.609.1.pom.ahcc7fe86ac64124fe0
plugin-1.609.1.pom.lastUpdated
Side note: I have never worked with Maven before, so please don't assume any knowledge thereof when answering.
pom.xml
<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.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.609.1</version>
</parent>
<artifactId>integrity-plugin</artifactId>
<name>PTC Integrity CM - Jenkins Plugin</name>
<version>1.37-SNAPSHOT</version>
<packaging>hpi</packaging>
<url>http://wiki.jenkins-ci.org/display/JENKINS/PTC+Integrity+Plugin</url>
<developers>
<developer>
<id>ALM_JenkinsPlugin_Support</id>
<name>PTC ALM Jenkins Plugin Support Team</name>
<email>ALM_JenkinsPlugin_Support#ptc.com</email>
</developer>
</developers>
<scm>
<connection>scm:git:ssh://github.com/jenkinsci/integrity-plugin.git</connection>
<developerConnection>scm:git:ssh://git#github.com/jenkinsci/integrity-plugin.git </developerConnection>
<url>https://github.com/jenkinsci/integrity-plugin</url>
<tag>HEAD</tag>
</scm>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-digester3</artifactId>
<version>3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-scm-step</artifactId>
<version>1.10</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.12.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.mks.api</groupId>
<artifactId>mksapi-jar</artifactId>
<version>4.13.5479</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.4.2</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<distributionManagement>
<repository>
<id>maven.jenkins-ci.org</id>
<url>http://maven.jenkins-ci.org/content/repositories/releases/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<compatibleSinceVersion>1.29</compatibleSinceVersion>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</project>
Things I have done
Remove entire .m2 folder
Download entire project new
Import new project again in eclipse
New error:
An internal error occurred during: "Updating indexes".
org/eclipse/core/runtime/internal/adaptor/BasicLocation
Old error persists
Looks like a corrupt m2 folder. What you should do is:
Close eclipse.
open up your m2 folder and delete the contents inside. (make a back up first in another location)
Remove the current project files.
Re-download a clean copy.
Open up eclipse. Upon the boot, eclipse will download its necessary dependencies for maven. Let it download everything at 100%.
During the download, it will look like this:
Once it is completed, import your project. After importing is done, maven will start building the work space again. Let it finish.
Afterwards, right click on your project Maven->Update Project . This will trigger maven to download the required dependencies written in the pom.xml.
I tested the project out and it updates perfectly.

Maven dependency not found for org.bukkit:bukkit

The groudID, artifactId and version dependencies are not being found in Maven?
I followed this tutorial to set up a Minecraft plugin which uses Maven.
But I get the error
org.bukkit:bukkit:1.7.2-RO3 not found
and the text font is red where everything else in the pom file is white.
Here is the code in the pom file:
<?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>
<groupId>com.chrismepham</groupId>
<artifactId>TestPlugin</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>bukkit-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.7.2-R0.3</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Why is the dependency not being found?
EDIT:
I changed the repository and dependency version as suggested but still have the error as shown in the picture:
The reason the text is red is because that dependency you've specified can't be found in either maven central, or the additional repository you've added.
Paste the repo link into a browser, and you'll find that the dependency is actually 1.8-R0.1-SNAPSHOT not 1.7.2-RO3 as the tutorial mentioned (maybe the tutorial is out of date, or that dependency has since been removed for some reason)
Change the dep to
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
If you haven't already set auto-import on intelliJ, you'll get a popup in the top right hand corner asking if you want to re-import. IntelliJ then reads your pom.xml file, works out what dependencies you need and then downloads them.
You should see org.bukkit.bukkit under external dependencies in the left hand "projects" window, along with some other libraries it depends on, such as guava and commons lang.
Bukkit as a Maven dependency suggests a different repository:
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
On inspection, it includes 1.7.2-R0.3.
(It also works over SSL, as https://repo.bukkit.org/content/groups/public/, which you should prefer.)
The dependency doesn't exist in the repo. If you follow the repository link, you see that the only version inside is 1.8-R0.1-SNAPSHOT. So you must change that version inside your pom.

Receiving could not resolve dependencies error when trying to add local dependencies to heroku java app

I am trying to follow the 'Adding Unmanaged Dependencies to a Maven Project' article on Heroku to add a local JAR dependency to a java project.
I keep on getting stuck at the Update Pom file section, where it tells me to add/update the repositories element.
I added the example repository elements to my pom.xml file and when i try to push my code to heroku i receive the following error:
Failed to execute goal on project fuji: Could not resolve dependencies for project com.example.fuji:fuji:jar:1.0-SNAPSHOT: Could not find artifact com.example.tambora:Tambora:jar:0.0.1-SNAPSHOT in project.local
It seems that I named either the repository id or name element wrong but I can't figure out what they should be changed too.
I am able to run this application locally without receiving any errors.
Heres my pom.xml 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.fuji</groupId>
<artifactId>fuji</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Fuji</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>com.example.tambora</groupId>
<artifactId>Tambora</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>7.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-logging-juli</artifactId>
<version>7.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>7.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<version>7.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper-el</artifactId>
<version>7.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jsp-api</artifactId>
<version>7.0.22</version>
</dependency>
</dependencies>
<build>
<finalName>fuji</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<assembleDirectory>target</assembleDirectory>
<programs>
<program>
<mainClass>launch.Main</mainClass>
<name>webapp</name>
</program>
</programs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<!--other repositories if any-->
<repository>
<id>project.local</id>
<name>project</name>
<url>file:${project.basedir}/repo</url>
</repository>
</repositories>
</project>
This is probably happening because com.example.tambora:Tambora:jar:0.0.1-SNAPSHOT is a SNAPSHOT, but SNAPSHOTs have not been enabled for your custom repository. According to Maven: The Complete Reference, this is required:
As a default setting, Maven will not check for SNAPSHOT releases on remote repositories. To depend on SNAPSHOT releases, users must explicitly enable the ability to download snapshots using a repository or pluginRepository element in the POM.
You should be able that like this:
<repository>
<id>project.local</id>
<name>project</name>
<url>file:${project.basedir}/repo</url>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</repository>
Also, when troubleshooting this locally, I would recommend deleting your ~/.m2/repo/com/example/tambora directory, because what's probably happening is that Maven is finding the JAR in your local repo instead of the one embedded in your project.

Categories