Month: April 2017

[Solved] JRebel can’t reload jsp in netbeans of spring boot project

JRebel can’t reload jsp in netbeans of spring boot project, asked in jrebel forum but seems no one can answer. I finally found a way to fix it. Don’t execute the “spring-boot:run” goal, directly run your main class, this make jrebel able to reload jsp/css/class, just tested. No matter you put your static files in src/main/webapp or src/main/resources, it just works.

dont touch the jrebel.xml

read count : 56

SQL to convert all tables from MyISAM to InnoDB

This is the SQL to convert all tables to InnoDB, relace the word to your database name, then run the output again.

SELECT CONCAT('ALTER TABLE `', TABLE_SCHEMA, '`.', TABLE_NAME,' ENGINE=InnoDB;')
FROM Information_schema.TABLES WHERE TABLE_SCHEMA = 'DBNAME' AND ENGINE = 'MyISAM' AND TABLE_TYPE = 'BASE TABLE'

read count : 14

netbeans api to read bookmark line numbers

Below code can read out bookmark line numbers for netbeans. For Java project, the bookmark line number are stored in nbproject/private/private.xml. If it is maven project, the private.xml is not exist but this code still work, there must be some place to store the bookmark info but I just don’t know. These code has a weak point, it won’t read the latest line numbers unless you close the project/netbeans.

			Project project = NetbeansUtil.getProject();
			AuxiliaryConfiguration config = ProjectUtils.getAuxiliaryConfiguration(project);
			org.w3c.dom.Element element = config.getConfigurationFragment("editor-bookmarks", "http://www.netbeans.org/ns/editor-bookmarks/2", false);
			ModuleLib.log("element=" + element);
			if (element != null) {
				NodeList list = element.getElementsByTagNameNS("http://www.netbeans.org/ns/editor-bookmarks/2", "bookmark");
				for (int x = 0; x < list.getLength(); x++) {
					org.w3c.dom.Element enEl = (org.w3c.dom.Element) list.item(x);
					String lineNo = enEl.getTextContent().trim();
					ModuleLib.log("line no=" + lineNo);
				}
			}

read count : 11

Netbeans plugins, able to compile and build != able to install in a clean netbeans

People reported my minimal plugins can’t install in their netbeans. I concluded these:

1) able to compile and build NOT EQUAL to able to install in a clean netbeans
2) able to install your plugin in your netbeans NOT EQUAL to able to install in a clean netbeans

When you meet this error : Project depends on packages not accessible at runtime

Just add the library to in pom

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.github.mcheung63</groupId>
        <artifactId>netbeans-minimap</artifactId>
        <version>2.8</version>
        <packaging>nbm</packaging>
        <name>Minimap</name>
        <description>Display the code minimap, programmer can overlook their code.</description>
        <developers>
                <developer>
                        <name>Peter</name>
                        <email>mcheung63@hotmail.com</email>
                        <roles>
                                <role>Founder</role>
                        </roles>
                </developer>
        </developers>
        <build>
                <plugins>
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>nbm-maven-plugin</artifactId>
                                <version>3.13</version>
                                <extensions>true</extensions>
                                <configuration>
                                        <!--<useOSGiDependencies>false</useOSGiDependencies>-->
                                        <moduleDependencies>
                                                <dependency>
                                                        <id>org.netbeans.api:org-netbeans-modules-editor-lib2</id>
                                                        <type>impl</type>
                                                </dependency>

read count : 27