How to enable jsp-tags autocompletion in NetBeans within NetBeans Maven projects? - maven

Using NetBeans 7.1.2.
When editing pages with NetBeans as per the procedure explained below, the IDE offers only autocompletion for <jsp:...> tags:
This is how I have created the NetBeans project and the jsp (though it isn't archetype specific, nor the issue has anything to do with opencms): I have created a maven project with the OpenCms-Module archetype
mvn archetype:generate -DarchetypeCatalog=http://bp-cms-commons.sourceforge.net/m2repo
The archetype creates a maven project with jar packaging.
After that, I have added a jsp under src/main/opencms/modules/blahblah/templates.
And then I have added the taglibs.standard dependency to the project, to try to provide NetBeans with the corresponding tlds.

After several hours trying to get this working, I found this reported and closed bug that hinted me into the right direction:
Added src/main/webapp directory Edit 1: There is autocompletion only for jstl tags if the files are inside src/main/webapp. Workaround in linux (not sure if windows links will work): Create a symlink:
ln -s opencms/ src/main/webapp from the project root folder
Change maven project packaging to war (Project properties -> General -> Packaging)
(Notice that neither the #taglib directive nor the taglibs.standard dependency are necessary.)
If the Web Pages entry does not appear under your project (in the projects view), you may need to restart NetBeans. Now you'll have full autocompletion (only) under src/main/webapp! :-)
Edit 2
Unfortunately, if under version control, NetBeans sees the symlink as a new directory, and all files under it, as new files :-( This is very inconvenient, because to access the IDE integrated version control functionality, you still need to open the original resource.

Related

How to save a module from one computer and import into into another computer in IntelliJ with Maven

I have a Maven module in IntelliJ which works fine from one computer. I have saved the ".iml" file together with the project in Git. When I check it out on another computer,
"New Project"
then "File" -> "New Module from Existing Sources" -> Select the ".iml" file, the structure is all there, but no Maven dependencies are resolved.
How do I get IntelliJ to download and import the Maven dependencies?
Things I have tried:
"Re-build Project"
Right-click the module and "Re-build module"
"File" -> "Invalidate Caches / Restart" (both invalidate and restart)
"Re-import All Maven Projects", this simply deleted the two Maven modules from the project. I then had to re-create the modules as above, once they were there again I had the same problem.
On the comand-line "mvn" is able to import the project and resolve all dependencies just fine.
Additional information:
The ".iml" file, when I look at it in a text editor, does not have any absolute paths in it.
Here is a picture of the module settings window:
If your goal is to just import the project on another PC, don't rely on the iml files. Some even consider it bad practice to commit IDE specific files in maven projects, as not everyone on a project might use the same version or even a different IDE. If you take a look at popular .gitignore files (e.g. this one), you'll most often find that any IDE specific files get excluded.
Consider importing the projects pom.xml:
Import Project -> from external model -> Maven
EDIT
JetBrains recommends to NOT include the iml file with Maven or Gradle projects, see here

Eclipse is not loading plugins placed into the "plugins" folder

I'm currently in a desperate situation right now, I already tried dropping the JAR file into both the "plugins" folder I created inside the "dropins" directory and also into the other "plugins" folder that was already created. I add the "-clean" option into the target of the eclipse shortcut and then I start eclipse. I go to the "plug-ins" section and try searching my plugin, but it does not appear.
I am using Eclipse Jee Neon and this is the JAR plugin I am attempting to use. Can anyone help me resolve this?
https://mvnrepository.com/artifact/org.codehaus.mojo/exec-maven-plugin/1.5.0

Is there anyway to specify project-specific coding style that will get loaded in IntelliJ from a pom.xml?

If I have a Maven project, and someone is going to load the project by opening the pom.xml file in IntelliJ, is there anything I can put in the file or elsewhere in the project that will load project-specific coding styles into the IDE?
Not by importing from a pom only. What you can do is add some IntelliJ files to the source code management tool. Idea saves its project specific code styles into /.idea/codeStyleSettings.xml - it may just picks it up after you imported the project via maven/pom.xml. I think it does not hurt to add a few other files too. Here is my .gitignore for intellij 13.1.5:
target/
# intellij settings files:
.idea/artifacts/
.idea/dictionaries/
.idea/copyright/
.idea/inspectionProfiles
.idea/libraries/
.idea/scopes/
.idea/compiler.xml
.idea/uiDesigner.xml
.idea/vcs.xml
.idea/rebel_project.xml
.idea/dataSources.ids
.idea/workspace.xml
Everything else is under version control. (some developers dont like that - I know - just wanted to mention it)

bndtools Activator bundle

How can I create a simple bundle with an Activator in bndtools?
It keeps saying that:
The JAR is empty: The instructions for the JAR named com.myproj did not cause any content to be included, this is likely wrong bnd.bnd /com.myproj Unknown Bndtools Problem Marker
Unused Private-Package instructions, no such package(s) on the class path: [com.myproj] bnd.bnd /com.myproj Unknown Bndtools Problem Marker
The way I create this project in Eclipse is:
Create new "Bndtools OSGi project"
Right click, configure - Convert to Maven project
Create Activator.java in package com.myproj.
Add com.myproj to private packages
Set activator to com.Activator
Here is my bnd file:
Bundle-Activator: com.myproj.Activator
Private-Package: com.myproj
My generated jar is empty. Any tips?
P.S.: Here is my eclipse project (exported as a zip-archive) in case it sheds any light on things: https://dl.dropbox.com/u/9162958/scraper.zip
My guess is that "Convert to Maven project" is the trouble. This likely has changed the Eclipse classpath for the project from the bnd default bin folder to 'target/classes'. Can you confirm that it works without converting to maven?
bnd can work with other places for the bin folder, you must set the ${bin} property (preferably in cnf/build.bnd). There are some writeups how to use bndtools with maven. The reason that bnd does not follow Eclipse's settings here is that they are not available without Eclipse and a design goal of bnd is that it builds anywhere: the bnd file must therefore be the final arbiter of information.
Anyway one more tip ... activators are not the right way to build OSGi builds since they are an evil singleton. Declarative services is far superior and we should actually have used a similar mechanism when we designed OSGi.
My setup:
Eclipse Luna 4.4.0 (20140612-0600)
Bndtools 2.3.0.REL-20140510-023245
Here is how I made it work:
I downloaded you exported scraper.zip.
Created and empty workspace in Eclipse.
Imported your project from the ZIP archive into the empty workspace.
The default cnf project was automatically created.
By default, bnd is configured to use the bin directory for compiled *.class files while your Eclipse project is configured to use target/classes. Therefore, I had to change this settings in cnf/build.bnd by adding a single line:
########################
## BND BUILD SETTINGS ##
########################
bin: target/classes
Now, after cleaning and rebuilding the project, bnd creates generated/scraper.jar that contains your Activator.class.
Notes:
You could also adapt your project configuration to use the bin directory instead of target/classes but I assume that you will use Maven later on.
When using bndtools, it sometimes helps when you start with an empty workspace and import your projects one-by-one.
There is a bug in bndtools 2.4 which causes some problems if there are multiple source directories per project. Therefore, I'm still using version 2.3

eclipse plugin won't install any more

I received a new version of a plugin of a project I work in collaboration with other people.I copied it over the old version in the /plugin directory. Eclispe (3.7.2 on Win7) ignored the plugin (don’t show up in the Help/About Eclipse/Installed Plugins). I put the old version back (I put an “_old” at the end of the .jar file) and it worked again but the plugin’s command in the menu appeared with a “%” character at the beginning. After some more copying of old/new version in the /plugin directory, even the old plugin won’t install. I put back an acient original version of the plugin, but still not working. It just stop suddenly working. I checked my permissions on the /plugin directory, started Eclipse as an administrator, but no success.
Thanks.
First of all you should put both versions in plugins directory only if they have different versions in plugin.xml definitions but even in this case only one of them probably will be active i.e. will add its contributions to Eclipse. You should use copy/paste actions to provide additionals to Eclipse carefully, plugins and features directories are not supposed for manual usage. To manage your plugins easily follow the dropins directory usage. For now the best you can do is to remove all versions of your custom plugin and run Eclipse to the clean workbench.

Resources