Vaadin + maven problems - maven-3

I'm trying to setup Vaadin for a new project.
I'm following the steps documented in https://vaadin.com/wiki/-/wiki/Main/Creating+a+Maven+project
The following command in empty directory:
mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.1.8
Gives me a following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.vaadin:vaadin-archetype-application:7.1.8) -> [Help 1]
I've also tried creating pom with:
<?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>group</groupId>
<artifactId>artifact</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>name</name>
<description>description</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vaadin.version>7.1.6</vaadin.version>
</properties>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>${vaadin.version}</version>
</dependency>
</dependencies>
</project>
Running mvm clean install results in the following error:
[ERROR] Failed to execute goal on project artifact: Could not resolve dependencies for project group:artifact:war:1.0-SNAPSHOT: The following artifacts could not be resolved: com.vaadin:vaadin-server:jar:7.1.6, com.vaadin:vaadin-client-compiled:jar:7.1.6, com.vaadin:vaadin-client:jar:7.1.6, com.vaadin:vaadin-themes:jar:7.1.6: Failure to find com.vaadin:vaadin-server:jar:7.1.6 in http://10.255.251.14:9991/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
Also there are the following warnings seen:
[WARNING] The POM for com.vaadin:vaadin-server:jar:7.1.6 is missing, no dependency information available
[WARNING] The POM for com.vaadin:vaadin-client-compiled:jar:7.1.6 is missing, no dependency information available
[WARNING] The POM for com.vaadin:vaadin-client:jar:7.1.6 is missing, no dependency information available
[WARNING] The POM for com.vaadin:vaadin-themes:jar:7.1.6 is missing, no dependency information available
At first we thought there might be some problems with our nexus installation, but we also tried running these commands from external machine without nexus. Same issues.

Try to add
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>

Add this to your pom.xml:
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>vaadin-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
Then you have to force the update. Example: mvn install -U

It seems that the problem is related to maven repositories and not vaadin.
I've tried locating computer in other country (most likely different maven repository mirror too) and it worked.
Update: I had it working for an hour or so without changing anything and then it started failing again.
This might be related to the heartbleed bug everyone is going crazy about at the moment. Admins probably patching it all over the place and there might be some disruptions to repository services or our own network.

Looks like the list of available archetypes isn't up to date.
Run this command mvn archetype:update-local-catalog

Related

Not able to deploy mule 4 application in on-premise using Jenkins pipeline

I'm trying to deploy mule 4 application using jenkin pipeline but in the deployement process getting the below mentioned error:
[ERROR] Failed to execute goal org.mule.tools.maven:mule-maven-plugin:3.3.5:deploy (default-deploy) on project helloworld: Execution default-deploy of goal org.mule.tools.maven:mule-maven-plugin:3.3.5:deploy failed: Mule Runtime is not running!
Adding my pom.xml.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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.mycompany</groupId>
<artifactId>helloworld</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule-application</packaging>
<name>helloworld</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<app.runtime>4.2.2</app.runtime>
<mule.maven.plugin.version>3.3.5</mule.maven.plugin.version>
<proejct.site.deploy.url>E:\IDFC\mule-enterprise-standalone-4.2.2\apps</proejct.site.deploy.url>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>${mule.maven.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<standaloneDeployment>
<muleHome>E:\IDFC\mule-enterprise-standalone-4.2.2</muleHome>
<muleVersion>4.2.2</muleVersion>
</standaloneDeployment>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-http-connector</artifactId>
<version>1.5.11</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-sockets-connector</artifactId>
<version>1.1.5</version>
<classifier>mule-plugin</classifier>
</dependency>
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-db-connector</artifactId>
<version>1.5.5</version>
<classifier>mule-plugin</classifier>
</dependency>
</dependencies>
<repositories>
<repository>
<id>anypoint-exchange-v2</id>
<name>Anypoint Exchange</name>
<url>https://maven.anypoint.mulesoft.com/api/v2/maven</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>https://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mulesoft-releases</id>
<name>mulesoft release repository</name>
<layout>default</layout>
<url>https://repository.mulesoft.org/releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
in Jenkins till build it's working but while deploying i'm getting error.
For the deploy process Using custom workspace Directory and executing the custom batch command mvn package deploy -DmuleDeploy.
Here it's failing with the below added error.
This is my standalone server where i have to deploy: C:\AnypointStudio\mule-enterprise-standalone-4.2.2\apps
Can you please check my pom.xml anything else do i need to add there?
let me know where I am doing wrong to deploy on standalone server?
The Mule Maven Plugin is complaining that the target standalone Mule Runtime at C:\AnypointStudio\mule-enterprise-standalone-4.2.2\ is not running. The log error says as much: Mule Runtime is not running!. The documentation for the standalone deployment configuration seems to imply that it should be executing.
You'll need to ensure it is up and running before trying to deploy to it.
Note, installing a standalone Mule Runtime inside a directory called AnypointStudio is a bit confusing. The standalone runtime is not part of Anypoint Studio nor it interacts with Studio in any way.

The POM for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7 is missing, no dependency information available

this is my environment.
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
Apache Maven 3.5.4
Nexus 2.14.8-01
Jenkins 2.136
my issue is I cannot perform a mvn clean deploy in Jenkins without it issuing error. the error:
[WARNING] The POM for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7 is missing, no dependency information available
[ERROR] Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-deploy-plugin:jar:2.7 in http://137.27.68.182:8082/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of ge-ip-nexus has elapsed or updates are forced -> [Help 1]
I'm rather new, and each experience brings me closer, but, I'm baffled.
In Nexus Maven Central, I look in Nexus repo, and under Browse Index, the maven-deploy-plugin:jar:2.7 exists, however, under browse storage, only 2.8.2 exists.
I'm not specifying or to my knowledge a specific version and wonder why doesn't it just use the maven-deploy-plugin:jar:2.8.2 ??? instead of the 2.7. and I can't find where the 2.7 is being declared. ??
thank you any suggestions on how to resolve or explain what the heck is going on would be much appreciated, IOU beer and more beer. :)
SETTINGS FOR JENKINS
<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">
<!-- The path to the local repository -->
<localRepository>/Users/212555427/devel/maven/repositories/ge-ip-jenkins-repository</localRepository>
<offline>false</offline>
<servers>
<server>
<id>com.ge.ip.snapshot.local</id>
<username>xxxxx</username>
<password>xxxxxx</password>
</server>
</servers>
<mirrors>
<mirror>
<id>ge-ip-nexus</id>
<name>Nexus Repository Manager</name>
<mirrorOf>*,!jbossRepos(x)</mirrorOf>
<url>http://137.277.686.182:8082/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<!-- A definition of a development profile -->
<profile>
<id>development</id>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>com.ge.ip.release</id>
<name>Release Repository</name>
<url>http://137.277.686.182:8082/nexus/content/groups/public</url>
</repository>
<!-- The specified location of where all snapshot artifacts are retrieved from. -->
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>com.ge.ip.snapshot</id>
<name>Snapshot Repository</name>
<url>http://137.277.686.182:8082/nexus/content/groups/public</url>
</repository>
</repositories>
<pluginRepositories>
<!-- The specified location of where all released plugins are retrieved from. -->
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>com.ge.ip.plugin.release</id>
<name>Plugin Release Repository</name>
<url>http://137.277.686.182:8082/nexus/content/groups/public</url>
</pluginRepository>
<!-- The specified location of where all snapshot plugins are retrieved from. -->
<pluginRepository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>com.ge.ip.plugin.snapshot</id>
<name>Plugin Snapshot Repository</name>
<url>http://137.277.686.182:8082/nexus/content/groups/public</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<!-- Specify the default active profile. -->
<activeProfiles>
<activeProfile>development</activeProfile>
</activeProfiles>
</settings>
POM:
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ge.digital.fleet</groupId>
<artifactId>ge.digital.fleet.parent</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>DIGITAL Fleet Parent</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<compiler.source.version>1.8</compiler.source.version>
<compiler.target.version>1.8</compiler.target.version>
<!-- JBoss Fuse Properties -->
<jboss.fuse.bom.version>6.3.0.redhat-310</jboss.fuse.bom.version>
<jboss.fuse.install>6.3.0.redhat-310</jboss.fuse.install>
<!-- Versions pulled from JBoss Fuse BOM for Dependency Management. -->
<cxf-version>2.17.0.redhat-630310</cxf-version>
<camel-version>2.17.0.redhat-630310</camel-version>
<activemq-version>5.11.0.redhat-630310</activemq-version>
<karaf-version>2.4.0.redhat-630310</karaf-version>
<hawtio-version>1.4.0.redhat-630310</hawtio-version>
<fabric-version>1.2.0.redhat-630310</fabric-version>
<junit-version>4.11</junit-version>
<log4j-version>1.2.17</log4j-version>
<velocity-bundle-version>2.17.0.redhat-630310</velocity-bundle-version>
<velocity-version>2.17.0.redhat-630310</velocity-version>
<joda-time-version>2.9.2</joda-time-version>
<!-- Versions of 3rd Party Dependencies -->
<ibm-mq-version>7.5.0.8</ibm-mq-version>
<!-- Test Dependencies -->
<ftpserver-version>1.0.6</ftpserver-version>
<sshd-version>0.10.0</sshd-version>
<greenmail-version>1.4.0</greenmail-version>
<!-- Plugin Versions-->
<version.maven-compiler-plugin>2.5.1</version.maven-compiler-plugin>
<bundle-plugin-version>2.3.7</bundle-plugin-version>
<build-helper-plugin-version>1.8</build-helper-plugin-version>
<resources-plugin-version>2.4.3</resources-plugin-version>
<felix-bundle-plugin-version>2.3.7</felix-bundle-plugin-version>
<lifecycle-mapping-version>1.0.0</lifecycle-mapping-version>
<maven-failsafe-plugin-version>2.8.1</maven-failsafe-plugin-version>
<depends-maven-plugin-version>1.2</depends-maven-plugin-version>
</properties>
<dependencyManagement>
<dependencies>
<!-- Import Fuse Dependency Management via BOM -->
<dependency>
<groupId>org.jboss.fuse.bom</groupId>
<artifactId>jboss-fuse-parent</artifactId>
<version>${jboss.fuse.bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>jcifs</groupId>
<artifactId>jcifs</artifactId>
<version>1.3.17</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda-time-version}</version>
</dependency>
<!-- Spring Dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.0.4.RELEASE</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.2.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.7.21</version> <!-- 5.7.21 5.1.27-->
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.dom4j</artifactId>
<version>1.6.1_5</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.poi</artifactId>
<version>3.9_2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-quartz</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-bindy</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http4</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-csv</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.maven-compiler-plugin}</version>
<configuration>
<source>${compiler.source.version}</source>
<target>${compiler.target.version}</target>
</configuration>
</plugin>
</plugins>
</build>
<!--
TODO
The url needs to be updated to the Corporate Nexus Instance.
This includes the hostname, port, and directory structure.
The <id> must match the <server> id in the settings.xml.
The settings.xml will contain the username/password.
Also note that only Jenkins should be doing the deploy, therefore
developer settings.xml SHOULD NOT contain the user name / password
of the <server>
-->
<distributionManagement>
<repository>
<id>com.ge.ip.snapshot.local</id>
<name>GE IP Releases</name>
<url>http://137.277.686.182:8082/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>com.ge.ip.snapshot.local</id>
<name>GE IP Snapshots</name>
<url>http://137.277.686.182:8082/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>
Does a direct download work?
http://137.27.68.182:8082/nexus/content/groups/public/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.17.pom
If it doesn't, examine the nexus.log file. You'll likely find the network connection from Nexus to Maven Central isn't working for some reason (e.g., it may be getting blocked by your firewall).
well, the reason for inability to access repos in nexus is due to company vpn security - not sure if it is the proxy or certs at this point.
but, If anyone knows how Maven determines the plugin releases or versions please post an answer. for instance if you simply issue a mvn clean deploy - how does maven know to pick deploy plugin 2.7 or 2.8 ?
thank you!
Specify a version/release for deployment plugin
clean package org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy

Maven prefixing WEB-INF/classes into JAR dependency

Update: Solved! Posted solution as my own answer. Will be accepting it in two days when I'm allowed to.
A little back story
I've been chasing down this rabbit hole for the past few days, and my question has drastically changed shape over that time. Initially, I thought I had an issue with Spring Boot, because it failed to parse one of my #Configuration annotated classes. Debugging that, I determined that Spring was looking in all the right places for one of my JAR-bound dependencies, but was coming up with a FileNotFoundException when trying to load a class from the JAR.
I was thrown off by this, because the JAR in question was quite verifiably on the classpath. I could print out the classpath during app startup, and see my JAR living nice and cozy inside.
So I simplified. And simplified. Eventually, I got things down to a project with two Java source files, and a tiny placeholder JAR pulled through Maven. This JAR only contains one file: tiny/jar/BaseTest.class.
This worked perfectly. From there, I swapped the dependency JAR on this small project. . . and startup failed. So I compared the JARs and noticed something odd.
The realization
While my small JAR contained a folder hierarchy of:
tiny/jar/BaseTest.class
The larger JAR looked like:
WEB-INF/classes/com/company/...
This WEB-INF/classes prefix is the poison which is killing Spring Boot's class loader. It expects to find classes starting from the root: com/company/... -- no prefix allowed.
I believe that Maven's dependency management is doing something tricky here. When my JAR is created using the clean install goal, it has the com/company/... root inside of it. If I manually copy this version of the JAR into my servers WEB-INF/lib folder, everything works, recognizes, and fires up perfectly.
But when Maven is used to bring in the dependency, WEB-INF/classes is prefixed on to my folder hierarchy, breaking everything.
The question
Does anyone know how I can prevent Maven from altering the directory structure of my JAR? The JAR is 100% correct until Maven pulls it in as a dependency, and suddenly the WEB-INF/classes prefix appears.
Here are the three POM files for reference. I've cut out a large swath of dependencies, but left everything else intact for easier reading.
Tiny Jar POM
<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>tiny</groupId>
<artifactId>jar</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<name>jar</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
</project>
Big Jar POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>company-foundation</artifactId>
<version>0.7.0-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</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-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-webflow</artifactId>
<version>2.4.0.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin> <!-- Sonar -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.5</version>
</plugin>
</plugins>
</build>
<repositories>
<!-- To use snapshots, you must also use the Sonatype Snapshots respository -->
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<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>
Project POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>dependency-issue</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>jar-dependency-issue</name>
<description>Barebones Spring Boot project used to demonstrate a JAR loading issue.</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.JarDependencyIssueApplication</start-class>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- To run on a separate server, we need to mark tomcat starter as provided. -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>com.company</groupId>
<artifactId>company-foundation</artifactId>
<version>0.7.0-SNAPSHOT</version>
</dependency>
-->
<dependency>
<groupId>tiny</groupId>
<artifactId>jar</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Solved my problem! I just got done poring over the configuring of my projects, comparing them for any suspicious deviations. Turns out that my larger JARs project in Eclipse had its Deployment Assembly (Found under Properties > Deployment Assembly) set to:
Source ============ Deploy Path
src/main/java --------> /WEB-INF/classes
src/main/resources -> /WEB-INF/classes
This caused my server to deploy the JAR into an internal /WEB-INF/classes folder.
Changing the Deploy Path setting to / fixed the problem! Everything is working perfectly now! Woo!

Proper adding repositories in Maven 3 pom.xml

Every time i build something with Mavent i muss struggle with the searching a proper repo for the required Maven artifact. As now i am searching the repo for the spring-aop but can not find one. Actual pom.xml follows.
How can i approach assembling pom.xml properly?
Thanks.
<repositories>
<repository>
<id>springsource-milestone</id>
<url>http://maven.springframework.org/milestone</url>
</repository>
<repository>
<id>org.springframework.repository.maven</id>
<name>SpringSource Maven Repository</name>
<url>http://repository.springframework.org/maven/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.aop</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
</dependencies>
The artifact spring-aop is present in maven central repo.
Normally most of the released artifacts are present in maven central which need not be explicitly specified in pom.xml. You can use the search option of the central repo for this.
In the question above, you would need to include the additional spring repos only if you were looking for milestone (alpha/beta) releases.
I would recommend to use a repository manager instead of added repositories to the pom.

Cannot resolve Mockito dependency in a Tycho project [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
How to reference mockito within tycho?
I am trying to get a test feature project building with Tycho, but it fails to resolve dependencies listed in my pom from the Maven central repository that is listed in my parent pom. Here is the relevant part from my parent pom:
<properties>
<tycho-version>0.12.0</tycho-version>
</properties>
<repositories>
<repository>
<id>helios</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/helios/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<pomDependencies>consider</pomDependencies>
<resolver>p2</resolver>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
and here my feature pom:
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>parent</artifactId>
<groupId>com.example</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.example</groupId>
<artifactId>com.example.testing.feature</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</dependency>
</dependencies>
when I run mvn clean package on my feature project, I get the following:
[INFO] Adding repository http://download.eclipse.org/releases/helios/
[INFO] Adding repository http://download.eclipse.org/releases/helios/
[DEBUG] Added p2 repository helios (http://download.eclipse.org/releases/helios/
)
[DEBUG] Ignoring Maven repository central (http://repo1.maven.org/maven2)
and then my build fails, because my dependency cannot be resolved. Am I missing something? Is this because of the p2 resolver configured for target-platform-configuration?
Indeed it seems you are correct.
First, create a Target Definition file (.target) and put it inside a Maven project, see here for example target: https://github.com/eclipsesource/com.eclipsesource.tycho.aspectj.demo/blob/master/platform/indigo.target
You need to attach the .target file to the artifact, using the build helper:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>indigo.target</file>
<type>target</type>
<classifier>indigo</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
(from https://github.com/eclipsesource/com.eclipsesource.tycho.aspectj.demo/blob/master/platform/pom.xml )
Then, in the parent POM or the plug-in projects that use that target definition file, you need to configure the "target" of target-platform-configuration Maven plugin, for example:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<ignoreTychoRepositories>true</ignoreTychoRepositories>
<target>
<artifact>
<groupId>com.eclipsesource.sandbox.weaving.demo</groupId>
<artifactId>com.eclipsesource.sandbox.weaving.demo.platform</artifactId>
<version>0.1.0-SNAPSHOT</version>
<classifier>indigo</classifier>
</artifact>
</target>
<environments>
<environment>
<os>${build.os}</os>
<ws>${build.ws}</ws>
<arch>${build.arch}</arch>
</environment>
</environments>
</configuration>
</plugin>
(taken from https://github.com/eclipsesource/com.eclipsesource.tycho.aspectj.demo/blob/master/releng/pom.xml )
Then your project(s) should build very nicely using Tycho. :-) If your .target references remote p2 repositories and not already in the p2 bundle pool, the necessary artifacts will be downloaded automatically.
Good luck!
Known Issue:
[WARNING] Target location type: Profile is not supported
As of Tycho 0.12.0, It means the "Eclipse Installation" target source type cannot be used with Tycho (yet?), along with "Directory" and "Features".
Solution: Use the "Update Site" target source.
If you don't have yet an update site, here's to generate an update site from an Eclipse (or from any folder containing bundles, for that matter):
/opt/eclipse_rcp/eclipse -consolelog -nosplash -verbose \
-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
-metadataRepository file:/home/ceefour/p2/bonita/ \
-artifactRepository file:/home/ceefour/p2/bonita/ \
-source /home/ceefour/BOS-5.5.1/studio/ \
-publishArtifacts
Note:
change /opt/eclipse_rcp to your own Eclipse SDK installation
metadataRepository and artifactRepository is the folder where the new update site will be created
source is --you guessed it-- the folder/installation containing the original bundles

Resources