Activate Checkstyle on Eclipse projects immediately after import - eclipse

When using a newly imported Maven project in Eclipse (Oxygen 4.7.1a), I have to manually Activate Checkstyle on the project in order for Checkstyle to run whenever the project's build happens.
We can see in a newly imported project into Eclipse that its .project file does not contain any Checkstyle natures or build commands:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>test-parent</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
After selecting Activate Checkstyle, the build command and nature are added to the .project:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>test-parent</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
</projectDescription>
Is there any way to activate Checkstyle immediately upon import of the Maven project into Eclipse so that the .project will already have the build commands & natures?

Unfortunately, this is impossible as not implemented in the latest version of Maven Eclipse integration (m2e). See https://dev.eclipse.org/mhonarc/lists/m2e-dev/msg01783.html for more details.
Here people discussed how to hack this by writing an Eclipse Mojo that updates .project appropriately after the import: https://github.com/oasp/oasp4j-ide/issues/1 . But this is still not done by anybody I believe.

Related

Each layer of the eclipse package shows all paths

My version of eclipse is 2022-03. I downloaded and installed spring tools4 from the Eclipse Marketplace and created a boot project through file - > New - > spring starter project,I have set Package Presentation - > Hierarchical.
Although the eclipse package is layered, each layer shows all paths.
uncropped screenshot Boot Project hierarchical
I test that the package of an ordinary Java Project is normal hierarchical.
Java Project hierarchical
This is my .project file.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>demo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

XPages: How to add a builder to an eclipse plugin project to build an XPage or custom control

I am building an XSP Plugin Project using Domino Designer which works fine after I followed the steps of https://frostillic.us/blog/posts/1934D011E867500185257EF10064C5AA&SessionID=D4TCTAVUQ2 on how to create such a project.
This project includes custom controls also, which I cannot edit with the graphical designer, this is ok for me. My problem now is, that, when I edit a custom control with the text-editor, the corresponding java file does not get re-compiled. What I am currently doing is editing the XPage in a temp. NSF and copy back the .xsp AND the .java file to the plugin project, customizing some path´s...this is a pain.
The .xsp-config file points to the location of the .java file in the project:
/com/adpunctum/aivistox/xsp/customcontrols/CCCategoryPicker
I added some builders form an NSF project and copied them to the .project file of the plugin-project.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.adpunctum.aivistox.xsp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.ibm.designer.domino.javalib.javalibmarkerbuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>com.ibm.designer.domino.design.jsvalidationbuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>com.ibm.designer.domino.ide.resources.facesConfigbuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>com.ibm.designer.domino.ide.resources.BuildPropertiesBuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>com.ibm.designer.domino.ide.resources.pluginXMLbuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>com.ibm.designer.domino.xsp.editor.xpagesbuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>com.ibm.designer.domino.ide.resources.LWPDBuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments/>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Does anyone have the clue how to get these java files complied ?
David, thank you for your hint - I just watched the video https://www.youtube.com/watch?v=Y4Rn_3Bmy0M
At the end of the show, he tells a very basic and - for me - important thing: If you want to change something, just "copy back the important files to the osgi plugin"...well, it seems that this is the only solution how to make changes in such a plugin: edit the custom controls in an .nsf project and copy the files to the plugin.
I don't have an answer, but maybe the XPagesDesignerPlugin4Eclipse project in OpenNTF Stash may point you in the right direction. Christian Guedemann was involved in the development of it, so may be able to advise.

resources not linked into final APK

I can run my app fine in the emulator and with the same source compile a final APK, but on another computer with exactly the same environment (Android-SDK, Eclipse and sources!) copied there, the project's resources are not compiled into the final APK when creating a distribution package.
As a consequence, the distribution APK is only 122k in size, while the correct size is supposed to be about 290k. It is displayed as "invalid" when trying to install it on a device.
Any idea why? It doesn't make a difference whether I'm using the original proguard file or an empty one.
I mean the file .project starting with a dot. It should look similar to this
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MiniCallWidget</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

Eclipse Build Path not available

The build path option is not available when I right clicked on one of the the jars I wanted to include. Anybody knows why? Thanks! The Eclipse version I am using is
Eclipse SDK
Version: 3.7.1
Build id: M20110909-1335
Right click on the Project and select properties.
2.Project facets --> java --> Apply
Right click on the project, choose 'Properties'. In 'Java Build path', go to the 'Libraries' tab, and click on 'add JARs' to include jar of the workspace in the build path of your Java project.
Make sure u have all the below,
1) settings folder
2) .classpath
3) .project
Just copy this and paste .project file, clean and build it,
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>XXXX</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
In the Toolbar Menu, click on "Window->Show View->Package Explorer.
This should fix the issue.
Go To Your Project Workspace=>inside in Project root Folder.You will see .project file Open that and replace with it.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
If you are using an osgi run configuration, Run -> Run Configurations... Select you laucher and click on the Bundles tab. Filter with org.eclipse.swt and make sure that the org.eclipse.swt and org.eclipse.swt.[arch].[version].jar are checked.
This drove me nuts until I did this simple thing. If you validate bundles without having checked these you'll get a "No Problems" dialog but you'll get this error at run time
Don't know the reason. But this works for me, so posting it.
Right-click on the project -> 'Properties' -> 'Java Build Path'

Missing builder(org.maven.ide.eclipse.maven2Builder)

I'm using Eclipse Indigo and have the following in my .project file:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>new project</name>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>
I have the m2e - Maven Integration for Eclipse installed. But I am getting Missing builder(org.maven.ide.eclipse.maven2Builder) under the Builders properties and I am getting a java.lang.ClassNotFoundException: when I try to running a class file from my project.
I guess I am missing something in the config somewhere or a plugin?
Thanks
It is most likely a mismatch between the declared builder class and your m2e plugin.
Try this:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>new project</name>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
Please note the different org.eclipse.m2e.core namespace.
While changing to the newer m2e plugin might work, it may not. You can install the older m2e plugin version which uses the old tag in Indigo. See http://m2eclipse.sonatype.org/installing-m2eclipse.html. Unfortunately, you can't have both the old and new installed at once, so if you managed to install the new one, you will have to uninstall it before installing the older version.
#LucaGeretti's answer was exactly my problem, fixing it in Eclipse Indigo can be done easily from the IDE:
Right click on your project.
Select 'Configure'.
Click 'Convert to Maven Project'.