How To Disable M2E Lifecycle Validation - m2eclipse

With Eclipse Mars comes the feature that M2E does not work like it used to. Lifecycle plug-ins are not found or are found twice, bringing curious error messages like this:
Plugin execution not covered by lifecycle configuration: org.acme.something:maven-plugin:1.0.0:compile (execution: default-compile, phase: compile)
Conflicting lifecycle mapping (plugin execution "org.acme.something:maven-plugin:1.0.0:compile (execution: default-compile, phase: compile)"). To enable full functionality, remove the conflicting mapping and run Maven->Update Project Configuration.
Since the Tycho integration never worked (and knowing these guys, never will) I want to disable the lifecycle validation for good. We only ever really need the M2E feature "Run as... -> Maven Build" anyways.
How do I do this?
(Just to be clear: I'm a professional, I have dozens of workspaces with dozens of projects each - using the "quickfix" on all of these to ignore them is out of the question, as is defiling my //pom.xml// with Eclipse specific ignore instructions.)

You have 2 solutions
Open the Markers view, Quick Fix, then select "Mark goal run as ignored in Eclipse build in Eclipse Preferences". This will be a global for the workspace, won't defile any of your pom.xml files. You can then go a step further and open Preferences > Maven > Licefycle Mappings, change the mapping file location so that it can be shared by multiple workspaces.
Open Preferences > Maven > Errors/Warnings, set Plugin Execution not covered... level to whatever works for you (and hope it doesn't cause unexpected side effects)

Related

How to keep certain Build Variant selected in Android Studio?

I understand from the documentation (reproduced below) that the Build Variants are generated during Gradle sync, but how could I keep a particular one "active" or selected in Android Studio?
Problem is that after checking out a branch I find the selected Build Variant has been reset.
I can not find an "active Build Variant" setting in any project (idea) files.
Have already seen this possibly related question.
Thanks.
Documentation from developer.android.com:
After the [Gradle] sync completes, Gradle automatically creates build variants based on your build types and product flavors, and names them according to . For example, if you created "demo" and "full" product flavors, and kept the default "debug" and "release" build types, Gradle creates the following build variants:
demoDebug, demoRelease, fullDebug, fullRelease
You can change the build variant to whichever one you want to build and run—just go to
Build > Select Build Variant and select one from the drop-down menu.
Updates:
Probably Android Studio 3.3+ is the way to go, as a new feature Syncing only active variant was introduced.
File → Settings → Experimental → Gradle → Only sync the active variant
Here it is. The one circulated by red rectangle is the active build variant.
For how to disable the enforced gradle sync:
Go to "Settings" -> "Appearance & Behavior" -> "System Settings"
Uncheck "Synchronize files on frame or editor tab activation"
But remember to click on the "Sync Project with Gradle Files" button whenever you make changes to Gradle.
My understanding is that AS (as of Jul 2019) will default to the first debug variant on the list, alphabetically. If you want it to default to a specific debug variant, see if changing the name to appear first alphabetically works for you.
That said, as a regular non-dev user of Xcode and AS to get access to the builds I need, I'd say that in your specific case OP, it's probably still worth it to teach your colleague what a build variant is, how to select it, and which one is valid for your project for the cases they need to use it in if they're going to be using AS to get builds a lot. Don't just change it to avoid having to explain it to them. That's not helpful to anyone: you're making a bunch of extra work for yourself and they'll never learn anything useful from it that way.
If this is for a stakeholder, rather than having them waste their time fiddling with AS, consider looking into build distribution tools like Fabric. Devs can control what Fabric beta group gets what build(s) and variants for each app pretty well.
I hope this answer helps someone out there. And good luck, OP. :)
This can now be set in the build type with isDefault parameter.
android {
buildTypes {
debug { isDefault = true }
}
}
https://issuetracker.google.com/issues/36988145#comment59

Where is Gradle autocomplete in IDEA?

I am using Gradle 2.3 inside of IntelliJ IDEA 15 CE and Android Studio 1.3.2 and have always wondered what the situation is with gradle autocomplete / syntax highlighting etc.
When I look at a build.gradle file most of the code is dark gray and underlined, even keywords like task giving Cannot resolve symbol 'task'.
Coming from using Java in IDEA I find it disorientating and I would expect that types (like Javadoc) would be click through-able and auto-complete would offer me relevant stuff (like the methods and properties of Javadoc when inside the above task).
It would also be great if I could enumerate the source sets for this build file via autocomplete at the sourceSets., which I appreciate may need gradle to have executed the config build step to provide this info.
Am I missing something obvious or is Gradle tooling inside IDEA just not as good as the Java equivalents?
Thanks!
It could be Cucumber for Groovy plugin. As I know Gradle use some techniques and syntax of Groovy, so I tried to install some Groovy plugins and success at the first try.
Steps to install this plug in:
on MacOS: Preferences... -> Install JetBrains plugin... -> Cucumber
for Groovy.

Does Intellij automatically update classes you've made changes to while in Debug mode?

I know that for css, html, and gsp files you can just refresh the browser without having to rebuild the application in order to see your updated changes. If you're stepping through code in debug mode, and make a change for a groovy or class file, do you have to rebuild the application in order to see the change?
IntelliJ does not update the classes in your running application automatically. You need to compile them manually (this will not be a full project rebuild - IntelliJ will build the project incrementally and compile only the changed classes and the code that depends on them), and then IntelliJ will offer you to reload the changes (which may fail if the changes you made aren't supported by the Java hotswap).
Note that some Web frameworks may be able to reload the changed classes automatically, independently of whether you're running your code from IntelliJ or not.
Say you're stopped on a break point, and want to edit the source code of the method you're in. Make the edit, save it, then run > Reload Changed Classes. Then, in the debugger controls, Drop Frame. Without dropping the frame, you won't execute the your newly recompiled method body.
By default, there's no keybindings for these 2 commands, but you can create them via the KeyMap in the settings (ctrl + alt + s). Even better, you can make a macro that will execute both these commands for you.
I wish it was easier and automatic, like in eclipse, but oh well.

How do I get rid of "Current text selection cannot be opened in an editor" in Eclipse?

Sometimes, I get this message in the status bar when I press F3 on a Type in a Java editor:
Current text selection cannot be opened in an editor
When I copy the selection into the clipboard and use Ctrl+Shift+T to open the "Open Type" dialog, I can paste the value and it will display the type and I can open it. The type is on the class path (no compile errors).
In other Java editors in the same project, F3 / Ctrl-Click works.
In the "broken" editor, it only works on internal fields and methods. For internal fields, it only works in the place where the field is defined. All places where a field is used are dead. "Mark Occurrences" works, though.
How do I get rid of it?
So far, I tried:
Close and open the editor
Clean the project
Clean all projects
"Update Project..." in the Maven context menu
Restart Eclipse
Restart Eclipse with -clean
This happens on Eclipse 3.7.2 with m2e 1.3.1 installed.
[UPDATE] This seems to be a bug somewhere in the depths of m2e and JDT. Usually, it appears when you have several projects (Maven multi module / reactor build) and the modules MA, MB and MC depend on each other:
MC depends on MB depends on an inner parameterized type X.Y<T> of MA.
and you have closed the module MB. On the classpath of MC, this will look like so:
MB.jar
MA
That is MB exists as a JAR on the classpath while MA is imported as an Eclipse project from the workspace.
In this situation, Eclipse gets confused when reading .class files in MB.jar which need inner parameterized types from MA. My guess is that it needs the type from MB.jar, parses it which tells it of the dependency to the type in MA which it then tries to parse only to find that the type parameter for T can't be resolved since parsing of MB isn't finished, yet.
There are three fixes:
Close MA. That will import everything as a JAR.
Open the project MB.
Make the inner type a toplevel type
[OLD]
If this happens, try these steps in order of increasing despair:
Close the editor and open it again.
Clean the project
Close the project and open it again.
Restart Eclipse
If all that fails:
Export your preferences
Exit Eclipse
Delete (or rename) the folder .metadata in your workspace. It's an invisible folder on some OSs but it's there.
Start Eclipse again
Import your preferences
Import all projects again. For this, select the workspace. Eclipse will then list all projects in the dialog and you can select all of them at once.
Related:
Bug 430605 - [select] Current text selection cannot be opened in an editor
There is a bug in Eclipse (in Luna at least) for a very specific workflow, which might not be the answer to this specific question, but might be helpful for others.
If you perform an import into the src (meaning src folder has focus before performing import) folder from an extracted jar (as source code), and you place breakpoints in the nested *.java files in the nested packages, it won't hit those breakpoints. In order to get things to work, you must keep hitting F3 instead of using "Open Declaration" to get to the *.java file you want to set a breakpoint in, then add the breakpoint by double clicking in the far left margin. Then Run > Debug As > Java Application.
this issue comes because eclipse workspace created by eclipse unable to load source code properly into its cache
please follow below steps to resolve this issue
goto eclipse workspace
for eg
i have loaded source code on below path:
C:\Users\ABCD\WorkingSourceCode7july (it will have .metadata)
just remove current working folder (WorkingSourceCode7july)
after that open eclipse again and create new working folder(WorkingSourceCode7july) and try to import same source code
i hope this may resolve the issue
this worked for me

Eclipse haml/sass editing + html /css generation

I've been playing with haml and sass and generating a flat site with staticmatic from the command line.
Has anyone been using an ide for this?
I have the Apatana studio (RadRails) plugin installed and it has haml & sass highlighting out of the box. For this site I just want a lightweight script project (no rails).
What type of project would I use, and how would i add something so i could for example, right click the project folder in order to run
staticmatic build [my-project]
(or other) to generate the site from the haml + sass?
I like staticmatic as I can use ruby libraries as helpers.
Happy to take suggestions about any editor. But i am also keen to stick with one editor for everything. (also WTB auto complete).
Cheers
You can run rake tasks from the RadRails IDE, though I didn't manage to get it work. Ruby is probably right choice for the project type. I don't like IDEs because they complicate and slow things down. So my choice is normally Textmate + terminal.
Take a look at Rakefile in this project: https://github.com/adamstac/staticmatic-bootstrap
This isn't exactly what you're asking for...but take a look at a tiny script that I wrote. It will watch directories of your choosing for changes in SCSS and HAML and compile them to html and css. You could make some minor edits to watch.rb if desired, run this in a terminal, and have the site generated without even having to run a command.
PS - if you decide to try this out, you'll need the fssm gem from github or rubygems.org.
A Ruby or Web project type would be most fitting, though I don't think it would matter which in this case.
You can achieve custom commands a number of ways...
You can write up a Rake task in the project Rakefile as Heikki suggested, and then right click and use the Rake menu (as of Studio 3.0.2) to launch that task, or run it inside the embedded Terminal view.
You can write/edit a custom ruble and add a command for launching staticmatic. See http://wiki.appcelerator.org/display/tis/Executing+an+External+Command
You can go the Eclipse route and create an "External Tool Launch configuration" under Run > External Tools. External Tools configuration... > Program. There you can set up a launch to execute some program (say the ruby interpreter or staticmatic script itself) and pass in the argument. Then you can use the run drop-down menu.

Resources