Maven install fired during Eclipse build - eclipse

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"

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.

Eclipse not compiling changes in any projects

Eclipse has just stopped compiling changes to any of my projects, not sure why. I still have build automatically selected. Seeing as it affects all my projects I doubt that is the issue.
Well, it depends.
Imported project from SVN/GIT? - Make sure the classpath and buildpath configurations are correct
Make sure your projects are Java projects
Make sure that your Source folders are on build path
Try restarting Eclipse or your machine from time to time
Prefs -> Java Compiler -> Use default compliance settings
Starting Eclipse with the -clean parameter might also help if everything GGrec wrote doesn't help.
Check this, if you have multiple projects in your Project Explorer that depend on each other:
Make sure there are no build path errors in one of your projects. You can find them in the Markers view (Window -> Show View -> Markers). Your project will have a red exclamation mark in the Project Explorer view as well.

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.

Ant task to refresh IvyDE Eclipse libraries

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.

eclipse debugger: attaching source-code of maven dependencies?

I'd like to use the source code of maven-managed dependencies when debugging our webapp in myEclipse 8.
I have managed to attach the sources to the libraries in the "Maven Managed Dependencies" classpath container, i.e. when I open a class file from a dependency (e.g. using Ctrl-Shift-T), I see the source code.
However, when I define a server connector for my tomcat, deploy the wepapp to it, and launch it in debug mode and execution halts on a breakpoint in that same class, the editor pane only displays the text "source not found", and a button to edit the "source lookup path". I have attempted to manually add the "Maven Managed Dependencies" classpath container, only to be told "Use maven project settings to configure depedency resolution". However, I see no useful setting in that property pane ...
How can I attach those sources? I am aware that this works with the m2e plugin and wtp, but I'd rather avoid convincing the rest of my team to switch plugins ...
Looks like issue MNGECLIPSE-983
I have confirmed that if I manually pick the External Archive option and find the relevant -sources jar (navigating that big .m2/repository tree to find it) and then add the jar as a sources it does work, and surprisingly it does remember the next time which isn't too bad.
That's at least doable I think for me because we don't often need to step debug through external dependencies, but when we do, it's often frequent, so adding it once while a bit of a pain, can be done on a case by case basis.
I have since discovered that this problem only occurs if the server is launched using a launch configuration.
The problem does not occur if the server is started by:
click the server icon in the toolbar -> context menu appears
mouse over the intended server -> submenu appears
click on "Start"
While this precludes sharing the server configuration by checking the launch configuration into version control, it at least allows seamless debugging.
Please do the following steps in Eclipse IDE(Tested with Version: 3.5.2),
In Package Explorer, Right Click on the Project which integrated with Maven container.
Select Maven 2 and then select "Fetch Source JARs".
The above action wil fetch sources of all the 3rd party jars present in the Maven Classpath.
Regards,
Rajesh.
Just put the .m2/repository/ folder itself with the search subfolders option.