Ant task to refresh IvyDE Eclipse libraries - eclipse

I use Ivy for dependency management with the IvyDE Eclipse plugin and I have dependent libraries that change quite frequently and Eclipse doesn't seem to refresh the libraries when I refresh the workspace.
<eclipse.refreshLocal depth="*" resource="/" />
Is there a way to get eclipse to refresh the Ivy libraries using an ant task, or refresh them upon a workspace refresh?

You could try to touch the ivy.xml.
This might trigger an update of ivy after a workspace refresh.

You can go in the Windows -> Preference -> on Eclipse Startup and change to Trigger Refresh

Can't you use Refresh or Resolve on the right-click menu for the "ivy.xml" Eclipse Library in the project?

To add to oers' answer and Pat B's answer above, you would need to go to Window > Preferences > Ivy, and change the following preferences:
Set "On Eclipse startup" to "Trigger resolve", and
Set "On Ivy File Change" to "Trigger resolve"
These should do the trick, especially in combination with the "touch" suggestion that oers made in his answer.

Related

Refreshing eclipse-project at the end of a maven build

Is there a possibility to refresh the files and folders of a project within eclipse at the end of a maven build automatically.
Usually I'm building from commandline. After a build e. g. the target folder should be refreshed.
Additional info: the maven build runs in the command line and eclipse should update automatically when it ended.
Use Run as -> Maven build... In the run configuration/build properties go to the refresh tab and select the refresh option you want.
Note that the eclipse build and the maven build may interfere, so make sure that you turn off the Build automatically option in the Project menu before staring the maven build. You may get indeterministic compilation errors otherwise.
Here is an eclipse plugin that implements the external hook for refreshing: https://github.com/andrask/maven-eclipse-control-plugin
I dont think so, there is no option to link the two things.
But eclipse has an option Refresh on access which might be useful for you.
For me, the accepted answer of using Run as -> Maven build... and the Refresh option did not refresh the target folder in Eclipse. I needed to do the following:
Preferences -> General -> Workspace -> Refresh using native hooks or polling
When enabled, any changes made by external editors will be automatically discovered by the Workbench. On some systems there may be a slight delay if polling is used.

Automatically update a maven project under eclipse, after a svn-checkout

After checking out a maven project from a svn-repository, eclipse shows dependency-errors.
To solve the problem,
I have to right-click on the project-folder,
then I have to click Maven --> Update Project
After doing that, the dependendicies of the pom-file are downloaded and the specific classpathes are set.
The problem: I have to do this everytime after a checkout of a maven-project.
My question: Why should I have to update manually the maven-project? Why didnĀ“t do this the maven-builder automatically? Is there any way to engage eclipse or the maven-builder to do this automatically?
If you have Subversive (installable via the Marketplace), you can checkout and set up the project in one step from Eclipse. In the dialog File -> Import try the entry Maven -> Check out Maven Projects from SVN.
Unfortunately, maven project configurations tend to get stale when you're changing stuff in the POM. Another tip from me is use the keyboard shortcut for "Update Project" (Alt-F5 on Mac & Windows) which should select the project you're currently in and has the option to update all projects at once.

Enable workspace resolution by default for m2e launch configurations

When I use Run as > Maven Build in Eclipse, "Resolve Workspace Artifacts" checkbox is unchecked by default. Is it possible to make it checked by default?
Number of Maven plugins may conflict with "Resolve Workspace Artifacts" feature (e.g. maven war plugin), so it is generally not recommended.
However, if you really need that feature, "Run as / Maven build" remembers previously launched and saved configurations and you can invoke them again from the same menu or using keyboard shortcut Alt-Shift-X, M.

Maven install fired during Eclipse build

Lately, I've noticed that whenever I run a build in Eclipse also the maven-install-plugin is fired (copying the jars in my machine local artifacts repository).
I also tried to exclude it from the Eclipse build with org.eclipse.m2e:lifecycle-mapping plugin but nothing changed.
Is that the standard behavior (that I honestly never realized) or is it my fault?
Stefano
This definitely isn't standard behaviour. See How to interpret the Lifecycle Mapping Dialog Box in M2E? for more details on how to interpret the mapping.
This is not standard behaviour. Is it possible that this workspace has "install" defined under Window -> Preferences -> Maven -> "Goals to run when updating project configuration"? This setting defaults to "process-resources"

Searching for dependencies returns nothing

I've just installed Eclipse Juno with m2e installed.
Then, I've created a new Maven project and decided I want log4j, so I opened the pom.xml, clicked on the Dependency tab, clicked on the Add... button and typed in log4j.
Zero results. The only thing that it finds is junit (that was automatically added to the project with the quickstart archetype, it seems). Note that I can add the log4j dependency manually and it will work just fine, but I find the search feature really convenient!
I'm a kind of a Maven beginner, though I got m2e working no problem in Indigo. So I'm thinking I might have forgot to set something?
All you have to do is update or rebuild your workspace maven repository index.
Open your "Maven Repositories" view. Open Global Repositories and right-click on central. Enable full index and rebuild.
Initially the process will take several minutes. After that your search will start working.
You can automate this process by turning Download repository index updates on startup on in your workspace preferences under Maven
in case rebuilding your workspace maven repository index didn't work, try reinstalling m2e. I updated mine via marketplace and it started working again. I'm not sure what was the issue but I suspect some URLs got changed recently.
Just go to Window -> Preferences -> Maven
and check the option Download repository index updates on startup and click Apply. That's all.