In our company, we've created a Maven plugin using maven-plugin-plugin v3.5, that normally contains 20kb.
The issue begun two days ago, because repo.jenkins-ci.org proxy is not working properly. So, our clients builds were affected because it wasn't possible to download the dependencies of our plugins, failing builds due:
Failed to collect dependencies at our-project:jar:1.6.2 -> our-project:jar:1.6.2 -> com.devfactory.utqg:utqg-github:jar:1.6.2 -> org.kohsuke:github-api:jar:1.77 -> com.infradna.tool:bridge-method-annotation:jar:1.14 -> org.jenkins-ci:annotation-indexer:jar:1.4: Failed to read artifact descriptor for org.jenkins-ci:annotation-indexer:jar:1.4: Could not transfer artifact org.jenkins-ci:jenkins:pom:1.26 from/to repo.jenkins-ci.org (http://repo.jenkins-ci.org/public/): Failed to transfer file: http://repo.jenkins-ci.org/public/org/jenkins-ci/jenkins/1.26/jenkins-1.26.pom. Return code is: 502 , ReasonPhrase:Bad Gateway. -> [Help 1]
So, our approach to that problem was focused in creating a Fat Maven Plugin (not a Fat Jar!). But, using Maven Shade plugin is not suitable for copying the artifacts, because plugin execution fails due the jar signature.
Does anybody have generated a fat Maven plugin? If yes, how?
The issue begun two days ago, because repo.jenkins-ci.org proxy is not
working properly. So, our clients builds were affected because it wasn't possible to download the dependencies of our plugins,
I recommend to run your own Maven Repository Manager to avoid these kind of issues: https://maven.apache.org/repository-management.html
Configure the single group in your settings.xml (mirror): http://books.sonatype.com/nexus-book/2.8/reference/maven-sect-single-group.html
Don't manage repositories in your POMs, but only as proxies in your Maven Repository Manager.
Related
Im trying to run maven on a linux server that does not have internet connectivity.
I installed maven but when I run "mvn compile" on my java project, it gets stuck trying to download plugins.
How do I get past it? Is there a place to get a full install with all plugins required so it dosent have to download anything?
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.apache.maven.plugins:maven-resources-plugin:jar:2.6 has not been downloaded from it before. -> [Help 1]
You can download all jars or import/move them already downloaded from another machine from userHome/.m2 to your ~/.m2 folder, and when you'll try to compile again it'll pull the libs/plugins from m2 folder without trying to download them.
No.
Running Maven does not make sense unless you are connected to a Maven repository.
If you have no internet connection then you need an internal Maven repository, i.e. a Nexus or Artifactory server in your company. Now this server does not only provide the dependencies for you, but also the plugins for Maven to run (of course, it has to get them somewhere from, so it needs some kind of connection to the internet).
I have cloned the git repository from https://github.com/viatra/org.eclipse.viatra.examples
and imported the project incquery-demo-generic (located in /query/headless-maven) as a Maven Project in Eclipse. Unfortunately I get the following error when I open the project's pom.xml:
Furthermore everytime when I click on "Run As" -> "Maven install" or "Maven build..." I get the following error message in the console:
Failed to execute goal on project incquery-demo-generic: Could not resolve dependencies for project hu.bme.mit.incquery:incquery-demo-generic:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at org.eclipse.incquery:runtime:jar:0.8.0-SNAPSHOT: Failed to read artifact descriptor for org.eclipse.incquery:runtime:jar:0.8.0-SNAPSHOT: Failure to find org.eclipse.incquery:org.eclipse.incquery.parent:pom:0.8.0-SNAPSHOT in https://repo.eclipse.org/content/repositories/emf-incquery-snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of incquery-snapshot has elapsed or updates are forced -> [Help 1]
Blockquote
In the Maven Dependencies Folder I can find some, but not all necessary jar files.
I have tried "Project clean", "Maven update", "Maven build... (Goal: clean package)" and to delete the .m2 repository and to re-build the maven project, but nothing helps.
I also tried to download some dependencies as .jar files and add them to the build-path, but they contain nothing but pom.xml and properties-files themself, thus I keep getting "cannot be resolved to a type" errors in relevant parts of the Java src-code.
Can somebody successfully run this project in her/his eclipse?
I am not an expert on Maven Projects so please tell me what to do in "layman words".
Thanks & kind regards,
MCRaven
The projects in the VIATRA examples repository (I notice it as one of the committers of the VIATRA project) are somewhat unusual: they are Eclipse plug-in projects that have Maven build informations added via Maven Tycho.
One more thing here: the 0.8.0 version of EMF-IncQuery bundles was released in 2014, thus it makes sense that the corresponding snapshot versions are removed. This means to me that this example was not updated for a long time. This is somewhat by design - some examples are not updated for each released version, but they are not are still available for references. If you are explicitly interested in this example, please contact us on VIATRA project forums or Bugzilla and we will provide example-specific support there.
Inside Eclipse we usually not rely on Maven (and our experience is that Tycho-based projects often does not work with M2E correctly). You could try to update Maven dependencies for the org.eclipse.incquery projects to 0.8.0, but I am still unsure whether it will work or not.
On the other hand, I'd rather suggest to install the old EMF-IncQuery version into your Eclipse instance and then simply rely on the Java Development Tools and the Plugin Development Environment to compile the project, and simply ignore any errors in the Maven descriptors for now.
When I execute the mvn install inside the project sm-core of Shopizer, I am getting the below error:
[ERROR] Failed to execute goal on project sm-core:
Could not resolve dependencies for project
com.shopizer:sm-core:jar:2.0.3-SNAPSHOT: The following
artifacts could not be resolved: com.shopizer:sm-core-model:
jar:2.0.3-SNAPSHOT, com.shopizer:sm-core-modules:jar:2.0.3-SNAPSHOT:
Failure to find com.shopizer:sm-core-model:jar:2.0.3-SNAPSHOT
in http://maven.springframework.org/snapshot was
cached in the local repository, resolution will not be
reattempted until the update interval of
org.springframework.maven.snapshot has elapsed or updates
are forced -> [Help 1]
How can I solve it?
The Shopizer project is actually a multi-module Maven project. This means that it has a root pom.xml of packaging pom and declares several <modules>.
Those modules, which are Maven project themselves, are typically found as sub-folders under this root folder, which is the case here: there are 4 sub-folders, which are exactly the 4 Maven modules. To compile those sort of projects, you need to invoke Maven from the root project, in this case, shopizer.
You may ask why. In a multi-module Maven project, there is generally inter-dependencies: one module is dependent on another. In this case, the scm-core module that you're trying to build has dependencies on both sm-core-model and sm-core-modules, which are two modules of that project. So when you're building it, Maven will try to look in your local repository those artifacts. The problem is that it won't find them: they have never been built before. Maven won't also find them on a public repository because we're dealing with SNAPSHOT dependencies. The solution is to start the build on the top project: Maven will order correctly the reactor so that when it builds scm-core, both those dependencies will have been built.
Put simply: in a multi-module Maven project, you should practically always invoke Maven commands from the root POM.
To solve your problem, you can check-out the 2.0.3 branch (which is the latest branch) and invoke mvn clean install on the root POM. I did just that successfully.
I have a Maven Nexus repository that manages several maven projects.Every time build happens on the specific project we send binaries/snap shots to Nexus.There are several ways to access nexus.
Nexus REST API
Aether
My requirement is that how can i fetch available list of artifacts from Nexus repository of a specific project and how can i inject older artifact(downloaded) into a local project when it execute.If any one knows how to do this Please share.I can not find any well documented examples.
If I understand your questions correctly you are looking at creating a runnable application for your Maven project that includes the dependencies.
This can e.g. for a jar project be done with the Maven Assembly Plugin and the jar-with-dependencies descriptor (see http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#jar-with-dependencies)
I have a project which has multiple sub projects (modules). More specifically this is an Eclipse project and has multiple features.
The issue is a feature might not need any changes for a release. For that reason I don't bump up the version number, but another feature in the same project might have changes. Since it is considered bad practise to re-deploy same versions I disabled that option in Nexus.
Now the actual problem occurs when I deploy. So deploying anything that has a new version number works fine, however when deploying old one I was sort of expecting maven to give warning that it already exits in repository and then skip it but turns out Nexus responds:
Return code is: 400, ReasonPhrase:Bad Request.
which then causes maven to fail the entire deployment process. The full error is:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project xyz: Failed to deploy artifacts: Could not transfer artifact xyz:target:2.5.8.0 from/to nexus (http://host/nexus/content/repositories/releases): Failed to transfer file: http://host/nexus/content/repositories/releases/x/targets/xyz/2.5.8.0/xyz-2.5.8.0.target. Return code is: 400, ReasonPhrase:Bad Request. -> [Help 1]
build 11-Sep-2015 07:09:57 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project abc: Failed to deploy artifacts: Could not transfer artifact foo:abc:jar:2.5.8.0 from/to nexus (http://host/nexus/content/repositories/releases): Failed to transfer file: http://host/nexus/content/repositories/releases/bar/abc/2.5.8.0/abc.ocl-2.5.8.0.jar. Return code is: 400, ReasonPhrase:Bad Request. -> [Help 1]
The question is, how can I handle this failure/exception? All I want is if it is already deployed then skip/ignore deployment of that artifact.
See Maven: The Complete Reference, 6.1. Maven Command Line Options, 6.1.8. Dealing with Failure or mvn --help:
-fae,--fail-at-end Only fail the build afterwards;
allow all non-impacted builds to
continue
It is generally accepted best practice in Maven to use the same version across multi-module projects. I would just switch to that scheme and deploy each module even if it didnt really change internally.
If you dont want to do that, it would be better to break your project up into multiple projects that are built and released separately.
The only hacky workaround you can otherwise do is to set the skip property for the Maven deploy plugin for projects that have already been deployed. You will however have to manually manage that and therefore produce additional overhead and churn on your codebase. See more at https://maven.apache.org/plugins/maven-deploy-plugin/faq.html