Hello Michael,

thank You for Your reply!

(1) I don't know about those .hint files, so especially I don't know about how much complexity they can handle. Do You have a link, probably?

(2) If complexity grows so that I cannot handle it with .hint files, I'd still prefer to have a fallback solution with Java classes, so adding the needed POM to the tutorial would still be great.

Kind regards,

Peter


Am 30.01.22 um 18:57 schrieb Michael Bien:
just to be sure: do you want to add custom code refactoring rules to netbeans which you can apply to your code or is it more than that?

because adding custom .hint files is now super easy, you can run them via default run action or register them globally etc.

putting them into a plugin would be for more advanced purposes (e.g if you want to familiarize yourself with the javac API).

-mbien

On 30.01.22 18:14, Peter Nabbefeld wrote:

Hello,

I tried to add a Java hint following https://netbeans.apache.org/tutorials/nbm-java-hint.html using Maven. Sadly, I still cannot run the project, nor does the automatically created test compile.

I've modified, I think, the POM according to the instructions found in the Test file, but obviously I must have misunderstood sth.

I'd be happy, if someone could add some clear advice to the tutorial.

Kind regards,
Peter


PS: Currently, my POM looks like this:


<?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>org.netbeans.examples</groupId>
    <artifactId>HintDemo</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>nbm</packaging>

    <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<org.netbeans.release>RELEASE124</org.netbeans.release>
<nb-javac.release>RELEASE82</nb-javac.release>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
    </properties>

    <build>
        <plugins>
            <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
<groupId>org.netbeans.external</groupId>
<artifactId>nb-javac-api</artifactId>
<version>${nb-javac.release}</version>
                                    <type>jar</type>
<outputDirectory>${endorsed.dir}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
<groupId>org.netbeans.external</groupId>
<artifactId>nb-javac-impl</artifactId>
<version>${nb-javac.release}</version>
                                    <type>jar</type>
<outputDirectory>${endorsed.dir}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
<groupId>org.apache.netbeans.utilities</groupId>
<artifactId>nbm-maven-plugin</artifactId>
                <version>4.6</version>
                <extensions>true</extensions>
            </plugin>
            <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
<endorseddirs>${endorsed.dir}</endorseddirs>
                </configuration>
            </plugin>
            <plugin>
<artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <executions>
                    <execution>
                        <id>default-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <systemProperties>
                                <property>
<name>java.endorsed.dirs</name>
<value>${project.build.directory}/endorsed</value>
                                </property>
                            </systemProperties>
                            <source>1.8</source>
                            <target>1.8</target>
<jvm>/usr/lib64/jvm/java-8-openjdk/jre/bin/java</jvm>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
                <version>3.1.2</version>
                <configuration>
                    <archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-api-annotations-common</artifactId>
<version>${org.netbeans.release}</version>
        </dependency>
        <dependency>
            <groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-java-source-base</artifactId>
<version>${org.netbeans.release}</version>
        </dependency>
        <dependency>
            <groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-java-source</artifactId>
<version>${org.netbeans.release}</version>
        </dependency>
        <dependency>
            <groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-spi-java-hints</artifactId>
<version>${org.netbeans.release}</version>
        </dependency>
        <dependency>
            <groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-spi-editor-hints</artifactId>
<version>${org.netbeans.release}</version>
        </dependency>
        <dependency>
            <groupId>org.netbeans.api</groupId>
<artifactId>org-openide-util</artifactId>
<version>${org.netbeans.release}</version>
        </dependency>
        <dependency>
            <groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-libs-javacapi</artifactId>
<version>${org.netbeans.release}</version>
        </dependency>
        <dependency>
            <groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-java-hints-test</artifactId>
<version>${org.netbeans.release}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-libs-junit4</artifactId>
<version>${org.netbeans.release}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-nbjunit</artifactId>
<version>${org.netbeans.release}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.netbeans.external</groupId>
            <artifactId>nb-javac-api</artifactId>
            <version>${nb-javac.release}</version>
        </dependency>
        <dependency>
            <groupId>org.netbeans.external</groupId>
            <artifactId>nb-javac-impl</artifactId>
            <version>${nb-javac.release}</version>
        </dependency>
    </dependencies>
</project>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists





Reply via email to