Saturday, 31 January 2015

link to my settings.xml file from Eclipse

If you work with MavenSW significantly, there's a good chance that you probably need to modify your settings.xml file quite often. If you are an EclipseSWdeveloper who does builds with Maven, it can be handy to provide a link to your settings.xml file from within Eclipse. In addition to convenience, Eclipse features XMLW code syntax coloring and validation, which can come in very handy when modifying XML files.
Typically, I like to link to several external files from Eclipse and have all these links in a convenient project. I like to create this project with an underscore at the beginning of its name so that it appears first in Navigator view. Below, you can see that I've created a General project ("_stuff"), and that it already contains a link to my TomcatSW server.xml file. The arrow icon in the corner of the icon indicates that this is a link to an external file.
Eclipse Navigator View
Let's add a link to settings.xml. To do this, I right-clicked the project and went to New → File.
New File
In the New File popup window, I clicked the Advanced button and clicked the "Link to file in the file system" checkbox. I clicked the Browse button and browsed to my settings.xml file that was located in my .m2 user directory and selected it. It's fine to change the "File name" if you'd like to, since this is basically just a label to the real file. I didn't change it in this example. When done, I clicked Finish.
Link to file in the file system
The settings.xml file now appears in the "_stuff" project. We can see it is a link to a file since we can see the arrow in the corner of the icon. If we double-click "settings.xml" it opens the external settings.xml file in Eclipse's XML editor.
settings.xml in Eclipse's XML editor
In this tutorial, we've seen how we can conveniently link to our settings.xml file from within Eclipse. In addition to convenience, we get the benefits of Eclipse's powerful XML editing capabilities.

No comments:

Post a Comment