Cannot update/download dependencies of Maven project - java

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.

Related

Vaadin 14 training "RouterAPI" is probably outdatedt, so mvn jetty:run raises an error. How do I need to change the POM file?

as stated I have trouble running mvn jetty:run with the existing vaadin exercise for routing in vs code. As the tutorial was already created under vaadin 10 the pom file is probably outdated, as the other trainigs worked perfectly fine with the mvn jetty:run command.
The exact error is:
No plugin found for prefix 'jetty' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\Dukatz\.m2\repository), central (https://repo.maven.apache.org/maven2)]
Sadly I'm pretty new do web application development, so I don't have the slightest idea, how to make it work. Hopefully you can help me.
The Tutorial: Vaadin Router Api Tutorial
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.vaadin.trainings.routing</groupId>
<artifactId>exercises-routing</artifactId>
<name>Routing Exercises</name>
<version>1.0.0</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
<!-- Dependencies -->
<vaadin.version>13.0.5</vaadin.version>
<servlet.api.version>3.1.0</servlet.api.version>
<!-- Plugins -->
<jetty.version>9.4.15.v20190215</jetty.version>
<maven.war.plugin.version>3.1.0</maven.war.plugin.version>
</properties>
<repositories>
<repository>
<id>vaadin-prereleases</id>
<name>Vaadin Pre-releases</name>
<url>https://maven.vaadin.com/vaadin-prereleases</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<type>pom</type>
<scope>import</scope>
<version>${vaadin.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Added to provide logging output as Flow uses -->
<!-- the unbound SLF4J no-operation (NOP) logger implementation -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-core</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet.api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.plugin.version}</version>
<configuration>
<archive>
<manifestEntries>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
</plugin>
</plugins>
</build>
</project>
There is no Problem with the pom file. Because it's an older lesson, there was no pom file created for the whole project, but only in the specific paths (like \exercises or \solutions). So running mvn jetty:run couldn't work. There was no pom in the directory. I started it in VS-Code with the Maven-Explorer jetty plugin but
mvn jetty:run -f "c:\Users\Dukatz\Desktop\VadinTutorials\Vaadin14-RouterAPI\Exercises\pom.xml"
would do the job from the command line.
Thanks me! I won't delete the question because, one day there's maybe someone as dumb as me.

"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>

Maven Clean Issue - Non-resolvable import POM - Could not transfer artifact from NEXUS

I am having problem doing a build on a new project.
The build works for the old devs on the project, but after cloning the projects and using the same version of maven. Its not working for me.
Initially, I was doing a mvn clean install
But, after some research I found out the same build error occured with a simple mvn clean.
The error is as follows:
C:\workspace\some-web-app>mvn clean
[INFO] Scanning for projects...
Downloading from nexus-public: https://company-net:8080/nexus/content/groups/public/org/jboss/bom/jboss-eap-javaee7-with-tools/7.1.0.GA/jboss-eap-javaee7-with-tools-7.1.0.GA.pom
Downloading from nexus-releases: https://company-net:8080/nexus/content/repositories/releases/org/jboss/bom/jboss-eap-javaee7-with-tools/7.1.0.GA/jboss-eap-javaee7-with-tools-7.1.0.GA.pom
Downloading from nexus-public: https://company-net:8080/nexus/content/groups/public/org/jboss/bom/eap-runtime-artifacts/7.1.0.GA/eap-runtime-artifacts-7.1.0.GA.pom
Downloading from nexus-releases: https://company-net:8080/nexus/content/repositories/releases/org/jboss/bom/eap-runtime-artifacts/7.1.0.GA/eap-runtime-artifacts-7.1.0.GA.pom
Downloading from nexus-public: https://company-net:8080/nexus/content/groups/public/org/jboss/spec/jboss-javaee-7.0/1.1.0.Final-redhat-1/jboss-javaee-7.0-1.1.0.Final-redhat-1.pom
Downloading from nexus-releases: https://company-net:8080/nexus/content/repositories/releases/org/jboss/spec/jboss-javaee-7.0/1.1.0.Final-redhat-1/jboss-javaee-7.0-1.1.0.Final-redhat-1.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-ejb-plugin is missing. # line 292, column 22
[ERROR] Non-resolvable import POM: Could not transfer artifact org.jboss.bom:jboss-eap-javaee7-with-tools:pom:7.1.0.GA from/to nexus-public (https://company-net:8080/nexus/content/groups/p
[ERROR] Non-resolvable import POM: Could not transfer artifact org.jboss.bom:eap-runtime-artifacts:pom:7.1.0.GA from/to nexus-public (https://company-net:8080/nexus/content/groups/public/)
[ERROR] Non-resolvable import POM: Could not transfer artifact org.jboss.spec:jboss-javaee-7.0:pom:1.1.0.Final-redhat-1 from/to nexus-public (https://company-net:8080/nexus/content/groups/
[ERROR] 'dependencies.dependency.version' for javax.enterprise:cdi-api:jar is missing. # line 136, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-core:jar is missing. # line 142, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-validator:jar is missing. # line 148, column 21
[ERROR] 'dependencies.dependency.version' for org.hibernate:hibernate-ehcache:jar is missing. # line 160, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec:jar is missing. # line 165, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.faces:jboss-jsf-api_2.2_spec:jar is missing. # line 171, column 21
[ERROR] 'dependencies.dependency.version' for org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:jar is missing. # line 177, column 21
The settings.xml is under C:\Users[User-ID].m2 as follows:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups />
<proxies />
<servers>
<server>
<id>nexus-public</id>
<username>user1</username>
<password>pass1</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>user1</username>
<password>pass1</password>
</server>
<server>
<id>nexus-releases</id>
<username>user1</username>
<password>pass1</password>
</server>
</servers>
<mirrors />
<profiles>
<profile>
<id>companydev</id>
<properties>
<unit-test-ldap-server-host>mis-dev</unit-test-ldap-server-host>
<unit-test-database-url>jdbc:mysql://mis-dev:1234/unit_test</unit-test-database-url>
</properties>
<repositories>
<repository>
<id>nexus-public</id>
<url>https://company-net:8080/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>nexus-snapshots</id>
<url>https://company-net:8080/nexus/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>nexus-releases</id>
<url>https://company-net:8080/nexus/content/repositories/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>companydev</activeProfile>
</activeProfiles>
</settings>
The POM for the module to be build is:
<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>sc.foc.fo.plc</groupId>
<artifactId>ams-parent</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>ags</name>
<description>desc .........</description>
<organization>
<name>Org Name</name>
</organization>
<distributionManagement>
<repository>
<id>deployment</id>
<name>Internal Releases</name>
<url>http://1.2.3.4:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>deployment</id>
<name>Internal Releases</name>
<url>http://1.2.3.4:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<properties>
<!-- Explicitly declaring the source encoding eliminates the following
message: [WARNING] Using platform encoding (UTF-8 actually) to copy
filtered resources, i.e. build is platform dependent! -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<commons-lang.version>2.4</commons-lang.version>
<deltaspike.version>1.8.0</deltaspike.version>
<jboss-spec-javaee-7.0.version>1.1.0.Final-redhat-1</jboss-spec-javaee-7.0.version>
<primefaces.version>6.1</primefaces.version>
<server-bom.version>7.1.0.GA</server-bom.version>
<!-- EAP7 version, according to https://stackoverflow.com/questions/38688392/slf4j-logging-with-jboss-wildfly-10 -->
<slf4j.version>1.7.7</slf4j.version>
<wildfly-maven-plugin.version>1.2.0.Alpha4</wildfly-maven-plugin.version>
<commons-io.version>2.4</commons-io.version>
<swagger-core-v3.version>2.0.2</swagger-core-v3.version>
<swagger-model-v3.version>2.0.2</swagger-model-v3.version>
<swagger-codegen-maven-plugin.version>2.3.1</swagger-codegen-maven-plugin.version>
<swagger-core.version>1.5.16</swagger-core.version>
<cxf-rt-frontend-jaxrs.version>3.1.12</cxf-rt-frontend-jaxrs.version>
<cxf-version>3.1.11</cxf-version>
<junit.version>4.12</junit.version>
<mysql-connector.version>5.1.45</mysql-connector.version>
<jackson-version>1.9.2</jackson-version>
<jax-rs-version>1.1.1</jax-rs-version>
<json4s-jackson-version>3.2.4</json4s-jackson-version>
<json4s-core-version>3.0.0</json4s-core-version>
<fasterxml-json-version>2.8.9</fasterxml-json-version>
<scala-lang-version>2.9.1-1</scala-lang-version>
<reflections-version>0.9.9-RC1</reflections-version>
<javassist-version>3.16.1-GA</javassist-version>
<paranamer-version>2.5.2</paranamer-version>
<scannotation-version>1.0.3</scannotation-version>
<swagger-version>1.5.1-M2</swagger-version>
<resteasy-jaxrs-version>3.0.24.Final</resteasy-jaxrs-version>
<javax-servlet-version>3.1.0</javax-servlet-version>
<mockito.version>1.10.19</mockito.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- JBoss distributes a complete set of Java EE APIs including a Bill
of Materials (BOM). A BOM specifies the versions of a "stack" (or a collection)
of artifacts. We use this here so that we always get the correct versions
of artifacts. Here we use the jboss-eap-javaee7-with-tools stack (you can
read this as the JBoss stack of the Java EE APIs, with some extras tools
for your project, such as Arquillian for testing) -->
<dependency>
<groupId>org.jboss.bom</groupId>
<artifactId>jboss-eap-javaee7-with-tools</artifactId>
<version>${server-bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.bom</groupId>
<artifactId>eap-runtime-artifacts</artifactId>
<version>${server-bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Define the version of the JBoss Java EE APIs we want to use -->
<!-- JBoss distributes a complete set of Java EE APIs including
a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or
a collection) of artifacts. We use this here so that we always get the correct
versions of artifacts. Here we use the jboss-javaee-7.0 stack (you can
read this as the JBoss stack of the Java EE APIs). You can actually
use this stack with any version of JBoss EAP that implements Java EE. -->
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-7.0</artifactId>
<version>${jboss-spec-javaee-7.0.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-cli</artifactId>
<version>7.2.0.Final</version>
<exclusions>
<!-- we exclude this because it's locally resolved at runtime, yet the dependency plugin attempts to download it -->
<exclusion>
<groupId>sun.jdk</groupId>
<artifactId>jconsole</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.1_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.faces</groupId>
<artifactId>jboss-jsf-api_2.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>${primefaces.version}</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.10</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<scope>provided</scope>
<version>${slf4j.version}</version>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>${commons-lang.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.5.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>nl.geodienstencentrum.maven</groupId>
<artifactId>sass-maven-plugin</artifactId>
<!-- Cannot use a later version! it uses classes that are incompatible
with the maven deploy plugin, and this can't be easily resolved
e.g. see https://stackoverflow.com/questions/43630262/how-to-exclude-a-direct-dependency-of-a-maven-plugin -->
<version>2.25</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4</version>
<!--
<configuration>
<systemProperties>
<property>
<name>unit-test-ldap-server-host</name>
<value>${unit-test-ldap-server-host}</value>
</property>
<property>
<name>unit-test-database-url</name>
<value>${unit-test-database-url}</value>
</property>
</systemProperties>
</configuration>
-->
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
</plugin>
<!-- plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<ejbVersion>3.1</ejbVersion>
</configuration>
</plugin-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<ejbVersion>3.0</ejbVersion>
</configuration>
</plugin>
<!--
To be able to share a single suppression files, regardless of how
maven is ran, we can't have this plugin running in the parent pom
(it has a circular dependency on the build-tools module).
Therefore, each module that should have dependencies checked
should include this plugin
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Has been disabled temporarily as the suppression of vulnerabilities CVE-2017-7656, CVE-2017-7658, CVE-2017-7657 and
CVE-2017-9735 do not work resulting in a Jenkins build failure.
Developers should uncomment this section, change the phase to compile below and run a standard mvn clean install whenever new
dependencies have been added in a pom to ensure that no further vulnerabilities are added or at least new suppressions are
added.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-->
<!--plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<cveValidForHours>96</cveValidForHours>
<failBuildOnCVSS>7</failBuildOnCVSS>
<suppressionFile>build-tools/dep-check-supression.xml</suppressionFile>
<assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>sc.foc.fo.plc</groupId>
<artifactId>ags-build-tools</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin-->
</plugins>
</build>
<modules>
<module>ags-build-tools</module>
<module>ags-core</module>
<module>ags-core-api</module>
<module>ags-jpa</module>
<module>ags-integration-authorise-api</module>
<module>ags-integration-authorise-api-impl</module>
<module>ags-integration-jboss</module>
<module>ags-database</module>
<module>ags-web</module>
</modules>
</project>
I'v added the latest version for the dependencies in the POM to hack d 7 errors related to "'dependencies.dependency.version' ". But, my colleagues did not have to add the version to theirs'. So, my hack is not acceptable! The dependency have a scope of 'provided' and should be provided by the container. After research, I learned the dependencies should be downloaded into my .m2 (local repo) for local build, but they should not be packaged into the final artefact during buld.
Also, the second issue which is still unresolved is the "Non-resolvable import POM: Could not transfer artifact". I am thinking its a proxy issue, but my colleagues reckon using my mobile hot spot should work. Any ideas will be appreciated. Thanks.
Any ideas what could possibly be the problem?
You don't have this entry under your dependencyManagement likewise do it for all your dependencies. Version should be added either on dependencyManagement or directly under dependencies
<dependencyManagement>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
<version>whatever-version-you-need</version>
</dependency>
</dependencyManagement>
If old devs can build, and you cannot, that means that old devs have some artifacts in their local Maven cache/repository, and you don't. You probably need -Pcompanydev to look in the local repository manager.
Thanks all, this got resolved by connecting to my home wifi (without company firewall, proxy etc), so I was able to progress further with downloading dependencies, but then I ran into another issue which I will raise a new question for. Thanks.
Thanks all for your contribution and time.
Problem was fixed by the support team white listing my machine and using corporate wifi.
Similar issue could arise from corporate proxy blocking downloading dependencies from certain sites. You can update the proxy settings in your maven settings.xml.

Maven TinyB failure: package tinyb does not exist

I am trying to do a program where I need using Aws sdk and TinyB library. FOr that reason I have decided to use maven to create the project and resolve the dependencies. However, I have been trying to compile the project with the package TinyB for more than a week without success. I would be very grateful if someone could teach me what I am doing wrong.
The failure message I am receving is the following:
C:/Users/fran/Desktop/RSSI_AWS_PROJECT/BleDistanceMeasurement/src/main/java/org/tfm/app/BleMng.java:[7,1]
package tinyb does not exist
And my pom.xml is:
<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>org.tfm.app</groupId>
<artifactId>BleDistanceMeasurement</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>BleDistanceMeasurement</name>
<url>http://maven.apache.org</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>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.327</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-iot</artifactId>
<version>1.10.34</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-iot-device-sdk-java</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-iot-device-sdk-java-samples</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.kura</groupId>
<artifactId>tinyb</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>tinyb</id>
<url>https://repo.eclipse.org/content/groups/releases/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I have opened the project with Eclipse IDE to know what is happening but I have seen that eclipse is recognizing the dependencies correctly.
TinyB dependencie scan
Project dependencies
TinyB library I have downloaded and compiled the source from here:
https://github.com/intel-iot-devkit/tinyb
But there is no maven repositories directly from intel so I have added the one form eclipse kura:
<!-- https://mvnrepository.com/artifact/org.sputnikdev/bluetooth-manager-tinyb -->
<dependency>
<groupId>org.sputnikdev</groupId>
<artifactId>bluetooth-manager-tinyb</artifactId>
<version>1.0</version>
</dependency>
This one gives me problems when compiling, it seems as if the repository hasn't been downloaded. But the foder with the jar exists (it shows the error quoted previously).
I have made some little programs with TinyB and they are working perfectly, so the program is compiled and installed correctly. The problem is I am not using maven in this little programs (I just add the import and point to the .jar when executing). Like this:
sudo java -cp examples/java/HelloTinyB.jar:/usr/lib/lib/java/tinyb.jar HelloTinyB
I have also try this other maven repository:
<!-- https://mvnrepository.com/artifact/org.sputnikdev/bluetooth-manager-tinyb -->
<dependency>
<groupId>org.sputnikdev</groupId>
<artifactId>bluetooth-manager-tinyb</artifactId>
<version>1.3.2</version>
</dependency>
In this case it recognizes the dependencies and compiles. The problem is it gives error when I try to execute the program:
java.lang.RuntimeException: Native library is out of date. Please update the native library.
at tinyb.BluetoothManager.getBluetoothManager (BluetoothManager.java:317)
Thank you very much for your help.
I see you are trying to use eclipse Kura too.
Did you achieve making it work?
I have the same issue.
By the way, I see that maybe your dependencies are not really valid, as sputnikdev has a library over tinyB, but, finally I have the same problem than you. These are my main dependencies:
<!-- https://mvnrepository.com/artifact/org.sputnikdev/org.eclipse.smarthome.binding.bluetooth.transport.tinyb -->
<dependency>
<groupId>org.sputnikdev</groupId>
<artifactId>bluetooth-manager</artifactId>
<version>1.5.3</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>
<dependency>
<groupId>org.sputnikdev</groupId>
<artifactId>bluetooth-manager-tinyb</artifactId>
<version>1.3.3</version>
</dependency>

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