After many hours struggling with the Eclipse target editor, I've figured out some dance steps that allow me to manage my P2 repos and .target files. Nearly all of my headaches were caused by cache invalidation issues. I'm very good about ensuring that feature and plugin versions change when any code changes (see Tip 3 below), so the target should be picking up new versions, but many/most times it doesn't. Especially when I'm using local P2 repos. Why are local repos cached?
If the target editor doesn't find a new version of a feature or plugin, and, instead, persists in loading a cached old version of feature or plugin from the repository, you'll need to use the reload option in the 'Available Software Sites' dialog works invalidate the cache. But there are two versions of that dialog.
Plan A: If you only use remote (http) P2 repositories then these instructions should work: https://eclipsesource.com/blogs/2012/08/31/reloading-your-p2-cache/
Plan B: But if you use a combination of remote and local (file: URI) P2 repositories, you'll need to invalidate the cache using a more circuitous route.
Click 'Add..." in the Target Definition page of the Target Editor.
Select 'Software Site', hit Next. Click the 'Manage' button in the upper right.
In the 'Available Software Sites' dialog, select the repository you want to invalidate the cache for and click 'Reload'.
Return to the target editor, canceling both dialogs you opened, then select the repo whose cache you just invalidated and click 'Update'.
If anyone knows a faster path to this dialog that includes local repos, please comment.
Tip 1: For Target editor's 'Update' and 'Reload' to at least partially work, the artifact version should be set to '0.0.0' for lazy resolution.
Tip 2. If you do much target management, I strongly recommend M. Barbero's free and powerful Target Platform Definition DSL plugin. It generates the .target files for you, eliminating most all the hassles with feature and plugin versioning in the .target file -- and helps avoids having to use the embarrassing Eclipse Target Editor. To eliminate more version discovery headaches strongly consider using the 'lazy' option for each feature and/or plugin. The installation instructions are here: https://github.com/eclipse-cbi/targetplatform-dsl
And a good overview is here: https://eclipsesource.com/blogs/2018/05/30/eclipse-target-platform-definition-dsl-and-generator/
Tip 3: Install and use Eike Stepper and Ed Merks' Oomph version control for the PDE. Huge timesaver and keeps you out of the version control penalty box. It comes standard with Eclipse now. It will watch for code changes in any project you enable it for, understands the relationships between features and plugins, notifies you of projects that are not under version control but should be, flags the stale version numbers in plugin and feature manifests for updates and more. It even suggests the right major/minor version numbers based on the kind of change you made. https://www.eclipse.org/forums/index.php/t/1100576/