When I load up a workspace (for Android Java development), Eclipse says in the status bar that it's updating indexes. The Progress tab reports that it's hitting maven.org.
I read up on Maven - seems like a build manager. What I don't understand is why my Android workspace needs it or why it's hitting the server in the cloud. Do I need it? If not, how do I safely remove it?
This is a general step that happens when m2e/m2eclipse (Maven integration for Eclipse) is installed, whether projects are actively using it or not.
This step can be disabled through the Eclipse preferences: Window / Preferences / Maven / "Download repository index updates on startup". This option is on the main "Maven" preference page (not a child page). Just uncheck the box to prevent this from happening.
The file that this is downloading is an index of all the available dependencies available in the Maven central repository for use in Maven-enabled projects, allowing them to be easily chosen and searched against within the Eclipse UI. It is mainly a user convenience, and isn't mandatory.
Related
I have downloaded a simple project from a Git repository and opened it in Intellij. A couple of the import statements are highlighted in red, stating "Cannot resolve symbol." The packages that cannot be resolved are: zaxxer, springframework.
Normally in Perl or Python I would fire up a dependency manager like CPAN and simply install them, but my understanding is that there isn't really any such thing in Java and that dependencies are resolved sort of on a project-by-project basis.
I have Maven 3 installed, and my project has a pom.xml file, for what it's worth. What should I do now?
If you have opened the project in IntelliJ you can right click the module and choose "Add framework support". Choose Maven there, if it isn't there then it is already enabled.
Then, simply open your pom file. When indexed there should appear an dialog in the lower right corner asking you if you want to auto import changes or just import them manually. Click on one of them and the dependencies will be added.
If you can't see this notification it may have already been shown, then simply press on the "Event log" in the bottom right corner and the notification should be displayed (with eventual other info).
Edit from OP: Solution was: 1) Turn on the view in View > Tool Windows > Maven Projects. There was no Maven project here, so I added it (selected the pom.xml). 2) As described in an answer at Failed to Read Artifact Descriptor: IntelliJ "In Intellij, go to File -> Settings -> Build, Execution, Deployments -> Maven Check the box, ‘Always update snapshots’
It's a little weird that "always update snapshots" isn't turned on by default for IntelliJ, but this got things working.
I am using Eclipse Mars 4.5.2 which by default contains Maven.
I created a new Maven project and when I try to add dependencies through pom.xml, by clicking on the dependency tab and adding it. After I entered "spring framework" in search bar, it is not showing any result (in windows 10).
How to fix this issue?
Just manually edit the pom.xml after creation of the project and e.g. search Spring on MavenCentral (e.g. here: http://search.maven.org/#search%7Cga%7C1%7CSpring).
Maybe not ideal on the long run but that should allow you to continue working on your project most quickly.
For some reason, Eclipse did not fetch the index from MavenCentral. Go to the "Maven repositories" view and click on "central" in "Global Repositories". You probably do not see elements in it. Make a right click and check whether the index is enabled. If it is, try "update". An update of central may take 30 minutes or more.
If none of this works (which is quite possible), throw away your local repository (in the .m2 folder in your home directory) and retry everything. Local repositories are sometimes broken.
In eclipse go to Window -> Preferences -> Maven
Then go to Window > Show View > Other > Maven > Maven Repositories
Click on "Full Index Enabled" and then click on "Rebuild index" as shown below
I installed following plugins in eclipse indigo in following order to start spring development
Spring Tools Suite
M2E (Maven)
after these two installations, it was giving error
jira connector not installed, so I installed the following plugin.
Atlassian Jira Connector
After installing Jira Connector, Eclipse Started showing the following error :
Uninstalled Jira Connector. Still Showing these Problems.
Any help would be appreciated.
Eclipse has major structural problems with uninstalls, which aren't really fixed even the latest luna. But don't worry, there are a lot of workarounds.
What you can do now and in similar situations:
1.
If you can even uninstall something, you won't get back its previous state before the install.
Because of it I use Eclipse normally with a trick: I store my main Eclipse install directory in a git repository, and so I can always switch back with a single command. But it is only a trick.
2.
There is a big chance, that only your workspace directory is damaged, and not your Eclipse. In this case you can solve this problem by reinitializing your workspace: make a backup, delete everything, recreate your workspace directory and finally import again your projects.
(For similar reasons it is also an useful trick to save your workspace metadata in a git repository as well.)
3.
In Eclipse, the menu items are created by modules. If an eclipse module is installed, it creates the changes in its internal configurations which create the menu items.
After a restart, Eclipse tries to restore your gui, and thus re-open its panels. But if a module uninstall is also happened, then its panels aren't restorable, resulting exactly your problem.
So, simply close the bad panels and try to reopen them. Sometimes it also works.
In short: recreate your workspace, it will probably help. And next time, use Eclipse with some good and frequent backup (I suggest git).
I'm using this technique to create a target platform for my Eclipse RCP projects: http://www.modumind.com/2009/09/01/creating-an-eclipse-rcp-target-platform/
The RCP SDK is downloaded directly using the software site. As for the delta pack, I manually downloaded it from website, and added the directory in the target definition file, which in my opinion is tedious when I want to upgrade the delta pack version next time.
Is it possible to download the delta pack using the software site too? Or at least do it in less manual and more maintainable approach?
Thanks.
Add a main eclipse update site to the target. Take care of the version.
Then from this site choose the RCP target and Equinox target features. Make sure to check "Include all environments".
Example of update site: http://download.eclipse.org/eclipse/updates/4.2
Addition
Here is the full answer to this question.
Preferred way of using the "DeltaPack"
The DeltaPack is used to get platform specific artifacts so that you can export your RCP product for multiple platforms. See the next section for more information on the DeltaPack
Adding platform specific artifacts
The preferred way of getting the platform specific artifacts is to just add them to the target platform. There is no need to look-up and download the "DeltaPack" if you follow these instructions.
Open Window/Preferences.
Find PDE/Target Platform
Select your (active) target platform
Click Edit
Click Add
Select "Software Site"
Click Next
In "Work With" type: http://download.eclipse.org/eclipse/updates/4.3 (replace 4.3 with your current version)
Check "Eclipse RCP Target Components"
Check "Equinox Target Components"
Uncheck "Include required software"
Check "Include all environments"
Press Finish
Press Finish
Press OK
Open your product file and select the "Export" option. You will see that the "Export for multiple platforms" checkbox is available.
Old way of using the "DeltaPack"
What is the DeltaPack
The DeltaPack is a distribution from Eclipse that contains platform specific files for all supported platforms and widget sets. It contains:
SWT Platform Layers
Various plugins to handle connection to the native OS widgets.
Various launchers (exe, cmd, etc..)
Files to launch Eclipse from the command line
Other platform specific plugins
Hooks into secure storage, native networking and native Eclipse filesystem hooks
In total there are some 70 plugins to support the complete range of supported operating systems (around a dozen).
When do you need it
You need it if you want to export your RCP application to multiple targets (a combination of OS/ARCH/WIDGETSET: e.g. linux/ppc64/gtk ). This is typically done from the product configuration file.
How to get it
You can get it from: http://download.eclipse.org/eclipse/downloads/
Click on any of the builds and look for DeltaPack. Please note that there are discussions on removing the DeltaPack and getting it the preferred way.
How to add it to your target platform
Download the DeltaPack as described above
Unzip it to a location .e.g. "C:\eclipse-4.4M7-delta-pack"
Open Window/Preferences.
Select PDE/Target Platform
Select your (active) target platform
Click Edit
Click Add
Select "Directory"
Click Next
In "Location" type: "C:\eclipse-4.4M7-delta-pack\eclipse"
Press Next
Press Finish
Press Finish
Press OK
Open your product file and select the "Export" option. You will see that the "Export for multiple platforms" checkbox is available.
During setting up a software site for your target, you can select 'Include all environments' (after unselecting 'Include required software'), which should make maintaining a delta pack unnecessary.
My solution for sharing delta-pack:
Download the official delta-pack
Convert it to update-site (or software-site as you call it)
Place the update-site to my own server (e.g. http://example.com/my-delta-pack)
Add the update-site to my target definition
ad 2)
I use a command-line tool called Publisher. It's a part of Eclipse IDE.
Example usage:
${eclipse.home}/eclipse.exe
-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
-metadataRepository file:/${basedir}/${target.delta}
-artifactRepository file:/${basedir}/${target.delta}" />
-source ${source.delta}
-publishArtifacts
-compress
When developing Maven web applications I usually resort the the jetty-maven-plugin to quickly launch my application for local testing and debugging. Using the launch with m2eclipse has the drawback of not properly including all sources for debugging, even though they are downloaded by Maven ( see Source lookup does not seem to work ).
What is the preferred way to debug Maven web applications in Eclipse? I'd especially appreciate configurations which work with the gwt-maven-plugin.
My preferred way to develop web applications with m2eclipse is to... not use it. Instead, I use the approach described in Debugging with the Maven Jetty Plugin in Eclipse that I'm quoting below:
Step 1
Go to the Run/External Tools/External
Tools ..." menu item on the "Run" menu
bar. Select "Program" and click the
"New" button. On the "Main" tab, fill
in the "Location:" as the full path to
your "mvn" executable. For the
"Working Directory:" select the
workspace that matches your webapp.
For "Arguments:" add jetty:run.
Move to the "Environment" tab and
click the "New" button to add a new
variable named MAVEN_OPTS with the
value:
-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y
If you supply suspend=n instead of
suspend=y you can start immediately
without running the debugger and
launch the debugger at anytime you
really wish to debug.
Step 2
Then, pull up the "Run/Debug/Debug
..." menu item and select "Remote Java
Application" and click the "New"
button. Fill in the dialog by
selecting your webapp project for the
"Project:" field, and ensure you are
using the same port number as you
specified in the address= property
above.
Now all you need to do is to
Run/External Tools and select the name
of the maven tool setup you created in
step 1 to start the plugin and then
Run/Debug and select the name of the
debug setup you setup in step2.
From instructions provided by
Rolf Strijdhorst on the Maven mailing
list
Stopping Jetty
In order to stop the jetty server the
"Allow termination of remote VM"
should be checked in debug dialog in
Step 2. When you have the jetty server
running and the debugger connected you
can switch to the debug perspective.
In the debug view, right click on the
Java HotSpot(TM) Client
VM[localhost:4000] and chose
terminate. This will stop the debugger
and the jetty server.
Try to avoid writing code which needs a container of some kind to debug. Always write code that can run independently and wrap it in a very thin layer for deployment (thin layer -> few lines of code -> few bugs).
If you really must, try MockRunner to emulate the app server.
Other than that, you can manually add the sources in the project properties.