building spring batch sample application - spring-batch

I am trying to build the sample application for spring batch 2.1.6. (ie. spring-batch-2.1.6.RELEASE/samples/spring-batch-samples) using maven but am getting this error for a missing plugin:
[ERROR] Plugin
com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE
or one of its dependencies could not be resolved: Failure to find
com.springsource.bundlor:com.springsource.bundlor.maven:jar:1.0.0.RELEASE
in http://repo1.maven.org/maven2 was cached in the local repository,
resolution will not be reattempted until the update interval of
central has elapsed or updates are forced ->
Is there another repository I can set up to get this plugin? I am a bit suprised to be getting this errror as this is the latest realease version of spring batch.
Here is the repository section from the pom as it came in the download:
<repositories>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle External</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

The project's parent pom has a bootstrap profile which contains the necessary repository definitions. Build the project with the command mvn test -P bootstrap and it will download the dependencies.
P.S. This is explained in the readme's instructions that how to build Spring Batch. It would be good if they would also tell how to do it in the instructions for using the samples - maybe you could file a bug report?

i am using maven3 and was able to solve this problem by adding this to my pom:
<pluginRepositories>
<pluginRepository>
<id>plugin.repo.maven.central2</id>
<url>http://objectstyle.org/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

The Spring batch Admin sample build is broken for sure. At least as of today.
The -Pbootstrap doesn't help and adding the repos in that profile in my local settings doens't help either.
When I attempted to build spring-batch-admin-sample, I found that I was missing dependencies of spring batch!
So I went to build that. There I found that I was missing org.neo4j:neo4j-cypher-dsl-1.9.M04 and also gemfire.7.0.1.jar. Adding repos doesn't help because of the maven2/3 incompatibility issues.
So a sure way to fix this is to go to each repo, download the missing dep and mvn install-file them.
So get the neo4j one here:
http://m2.neo4j.org/content/repositories/releases/org/neo4j/neo4j-cypher-dsl/1.9.M04/
Get the gemfire one from here:
https://repo.springsource.org/gemstone-release-cache/com/gemstone/gemfire/gemfire/7.0.1/
And then I ran into a foundrylogic.vpp dependency that I found here:
http://objectstyle.org/maven2/foundrylogic/vpp/vpp/2.2.1/
Don't forget to get the corresponding poms also to keep it clean and get all the transitives, if any.
Use the mvn install-file plugin described here to get all three deps to your local repo.
http://maven.apache.org/plugins/maven-install-plugin/usage.html
Now spring-batch should build clean.
Now if you go to build spring-batch-admin it will still fail because it depends on spring-batch-core-2.2.3.BUILD-SNAPSHOT whereas what we just built was version 3.0.0.BUILD-SNAPSHOT.
So go to spring-batch-admin-parent's pom and modify the pom like so:
<!-- <spring.batch.version>2.2.3.BUILD-SNAPSHOT</spring.batch.version> -->
<spring.batch.version>3.0.0.BUILD-SNAPSHOT</spring.batch.version>
And then step back to spring-batch-admin and mvn clean install should build the sample.
Hope this helps someone!

I installed maven 3.2.1 and it works.

Related

Spring boot not compiling

I am trying to compile the project https://github.com/spring-cloud/spring-cloud-aws but the parent project has references to flatten-maven-plugin thus i am getting the error.
If this plugin is public i am not sure why i am getting the error as below. I am not able to get rid of this plugin. I opened a ticket on the git project but as it may not gather any answer.
Error resolving version for plugin 'org.codehaus.mojo:flatten-maven-plugin' from the repositories [local (C:\Users\ranajit.jana\.m2\repository), central (https://repo.maven.apache.org/maven2)]: Plugin not found in any plugin repository pom.xml /spring-cloud-aws-**** line 1 Maven pom Loading Problem
I am compiling this code as i want to make some changes.
Anyone has idea what can be done ?
=============================
This is resolved now.
This is was repo issue the plugin repo was pointing to repo1.maven.apache.org/maven2 which could not resolve this plugin.
I had to add the following to resolve this issue..
This is added as one additional plugin repo
<pluginRepository>
<id>maven-plugin-repo-mvn</id>
<name>Maven plugin repo maven</name>
<url>https://repo.maven.apache.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
Open the .m2/repository and proceed to the path org/codehaus/mojo/flatten-maven-plugin/. There delete the subdirectory version number. and all contained files. Maven will automatically download them the next time they are required.

Citrus version and Cucumber version issue

Citrus 2.7.7 is not compatible with cucumber 3.0.2 or later and when I check the sample from GitHub, they are using 2.8.0-SNAPSHOT with cucumber 3.0.2. So when is the 2.8.0 release version will be out? For me, I am able to get the 2.8.0-SNAPSHOT without any issue. But for some of my colleague they are not able to get it even with this.
<repositories>
<repository>
<id>consol-labs-snapshots</id>
<url>http://labs.consol.de/maven/snapshots-repository/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>interval:10080</updatePolicy>
</snapshots>
</repository>
</repositories>
#Sven Hettwer,
There is no error message, it just says not able to find the artifact!
We're planning to release 2.8.0 no later than by the end of the year. Stay tuned on twitter or on http://citrusframework.org/.
The maven config seems to be okay so far. Could you provide some information about the error message?
Edit:
Have your tried the -U flag for maven? E.g. mvn clean install -U to force updates on snapshots?
BR,
Sven

Finding missing Maven artifacts

I'm new to Maven, and struggling with adding dependencies. I'm trying to convert an existing project to Maven, and after adding the dependencies for all the jars in my referenced libraries, I'm receiving an error message about missing artifacts:
Missing artifact stax:stax:jar:1.0
Missing artifact clover:clover:jar:1.3-rc4
Missing artifact log4j:log4j:bundle:1.2.16
Missing artifact stax:stax-ri:jar:1.0
From reading this post: How to handle Maven missing artifact errors?, it sounds like I need to manually download these jars and add them to my local maven repository. My question is how do I find these jars? I tried googling them, and I can find jars that have similar names, but not exactly like these, so I'm not sure if they're the right jars.
Any tips for dealing with this problem? The log4j jar is the only one explicitly listed in the referenced libraries of my original project, so I'm guessing the other ones are required by other jars that I have, and I don't know where to find them or what their exact names should be.
Thanks!
Thanks to everyone for responding. The actual cause of the problem is that for each of those 3 missing artifacts, for some reason, when Maven downloaded them into my local repository, .lastUpdated was appended to the end of the jar. For example, stax-1.0.jar.lastUpdated. This is the reason Maven could not find stax-1.0.jar.
So, to fix this problem, I had to manually download stax-1.0.jar, then install it into the local maven repository in the exact same place as the messed up file, so that Maven could find it. (For example, using the command:
mvn install:install-file -Dfile=<path-to-file>/stax-1.0.jar
-DgroupId=stax -DartifactId=stax -Dversion=1.0 -Dpackaging=jar
Using the same exact groupId and artifactId as the existing, incorrect file was crucial in order for maven to find it.
You can find dependency search Sites under maven.apache.org. Go to the left side Navigation MenĂ¼ entry FAQ (official) and Thun to end of page.
It's more likely that your POM definition is not correct for log4j. Everything relating to log4j should be readily available in maven.
Also, if you know the name of the bundle (such as log4j) you can almost always do a quick google search "[bundle name] maven pom" within the first few hits you should either get the maven repo containing a quick snippet on how to include it, or the actual website for the bundled up jar and the maven instructions.
For example log4j:
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
</dependencies>
Sometimes though you just need to specify the repository to find the item in (if it's not hosted in the greater maven repositories)
You can specify a new repository like so
<repositories>
<repository>
<id>Java.Net</id>
<url>http://download.java.net/maven/2/</url>
</repository>
</repositories>
Finally when you absolutely cannot find the artifact already maven'd up for you (this is usually true for proprietary jars and or drivers that you cannot include with your project) you can have the user manually install the item via command line
mvn install:install-file -DgroupId=[group-id] -DartifactId=[artifact-id] -Dversion=[version] -Dfile=/path/to/the/file -Dpackaging=[type]
You can then reference it in your maven file using the information described above
For example I have a custom reference for a salesforce.com project
mvn install:install-file -DgroupId=com.salesforce -DartifactId=wsc -Dversion=22 -Dfile=\tsclient\H\development\java\wsc-22.jar -Dpackaging=jar
To access it in maven:
<dependency>
<groupId>com.salesforce</groupId>
<artifactId>wsc</artifactId>
<version>22</version>
</dependency>
Finally, you can find the jars (or their maven info) at their respective websites (please note I'm just basing these links off the jar names, these may not be the actual websites, well sans the log4j which I know to be correct)
Stax
Clover
Log4j
Use maven search or mvnrepository.com. If you can not find use google looking for jar in other public repositories, for example for stax:
maven stax-ri pom
My first result is:
http://maven.nuxeo.org/nexus/content/groups/public/stax/stax-ri/1.0/
Other public repositories:
http://download.java.net/maven/2
http://download.java.net/maven/1
http://repository.codehaus.org
http://repository.jboss.org/nexus/content/groups/public-jboss
http://maven.springframework.org/release
you can try to add new repositories to your pom.xml
<repositories>
<repository>
<id>java.net</id>
<url>http://download.java.net/maven/2/</url>
</repository>
<repository>
<id>jboss</id>
<url>http://repository.jboss.com/maven2</url>
</repository>
</repositories>
After several days this stupid error bugged me, I found the following article
The author describes that there is a workspace repository, which may out of date. In my case it helped just to import the correct plugins again. The workspace repository has been updated and everything is fine.
Your problem might be something to do with MNG-4142. This bug means that maven will not download a new snapshot if localCopy is set to true in the artifact maven-metadata-local.xml.
Note that the title of this bug is slightly misleading so it is work reading the comments.
You might think that using the -U flag with maven would fix this problem but apparently this is not the case.
The current workaround seems to be searching for all instances of maven-metadata-local.xml and changing the value of localCopy to false.
I solved this problem by changing the log4j version from 1.2.15 to 1.2.16.
It also could be cause by the dom4j. The same error occurred when I use the following settings.
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>20040902.021138</version>
</dependency>
After changing to the following, the error disappeared.
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>

Unable to update EclipseLink with M2Eclipse

I am using Eclipse with Maven (using m2eclipse) and attempting to add the EclipseLink repository.
Within my pom.xml I have set the following:
<repositories>
<repository>
<id>eclipselink</id>
<url>http://www.eclipse.org/downloads/download.phpr=1&nf=1&file=/rt/eclipselink/maven.repo</url>
</repository>
</repositories>
I then navigate to the Maven Repository Window and right click the repository and select Full Index Enabled.
This results in the following message being displayed:
4/23/11 1:45:53 PM BST: Updating index eclipselink|http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo
4/23/11 1:45:54 PM BST: Unable to update index for eclipselink|http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo
Any help in solving this problem would be appreciated.
If you call that page you will get an 404 page not found...so the url must be wrong.
There may not be anything to worry. It is possible that Eclipselink repository is not having a repository index file which is requested by m2eclipse.
What is important is to check if dependencies specified in your pom, present in Eclipselink repository are getting downloaded correctly.
You have a typo in URL:
It should be:
http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo
You missed question mark.
Source:
Can't find the "org.eclipse.persistence" Maven dependency

How do I build latest Tycho

I've tried to build Tycho now for a couple of hours and just can't get it to work. I've followed these instructions:
https://docs.sonatype.org/display/TYCHO/BuildingTycho
So, I've downloaded Eclipse 3.6RC2 and Delta-packs linked from this instruction (is it for 3.5 only?):
http:// (remove space) aniefer.blogspot.com/2009/06/using-deltapack-in-eclipse-35.html
I've added the DeltaPack to the TargetPlatform inside of the Eclipse-installation.
I've installed Maven: Apache Maven 3.0-beta-1 (r935667; 2010-04-19 19:00:39+0200)
I can run the first bootstrap of the build, but the second fails:
mvn clean install -e -V -Pbootstrap-2 -Dtycho.targetPlatform=$TYCHO_TARGET_PLATFORM
ERROR] Internal error: java.lang.RuntimeException:
Could not resolve plugin org.eclipse.core.net.linux.x86_null -> [Help 1]
I've tried different stuff, I built an older revision against 3.5 as in this blogpost:
http:// (remove space) divby0.blogspot.com/2010/03/im-in-love-with-tycho-08-and-maven-3.html
and that actually built a running maven, but that version then can't find the tycho plugin:
org.apache.maven.plugin.version.PluginVersionResolutionException: Error resolving version for plugin 'org.codehaus.tycho:maven-tycho-plugin' from the repositories [local (/Users/viktor/.m2/repository), central (http://repo1.maven.org/maven2)]: Plugin not found in any plugin repository
I thought that the point was that the plugin was going to build in when I had built a Tycho-dist…?
Sorry about the links, stackoverflows spam-protection doesn't let me post more than one url yet
The Tycho documentation is pretty bad, to set the record straight, Tycho is included in the Maven repositories by default now; declaring it in your POM will automatically download it and allow you to use it.
To cut to the chase, this is all you have to put in your Maven POM to use Tycho, and then next time Maven uses this POM for a project, it will get Tycho if you don't already have it and use it for the build. At the time of this writing, 0.12.0 is the latest stable release.
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>0.12.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
Now, say, you would like to use an "unstable" Tycho, like <version>0.13.0</version>. Then you would want to change the version number in the plugin to the appropriate value, and then add this (The latest Tycho repository) to your POM:
<pluginRepositories>
<pluginRepository>
<id>sonatype-release</id>
<url>http://repository.sonatype.org/content/groups/sonatype-public-grid
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
That simple.
With the move to eclipse.org, we also invested in better documentation for contributors:
http://wiki.eclipse.org/Developing_Tycho
http://wiki.eclipse.org/Tycho/Contributor_Guide