November 16, 2024

Another Linux lie: we have a build system with package management for Java

Another Linux lie: we have a build system with package management for Java

Truth is: you kind of do but it sucks.

Enter maven, the inglorious, infamous half-zombie, in DnD terms.

You think that by creating a Maven project in your favorite IDE you are going to arrive at a finished, runnable product? You are wrong. They fooled you. You will not.

They will blow smoke in your face and make you believe that everything is nice and dandy, by running your app in the IDE without any issues. Not so much on the command line.

Here's what you actually have to do in Netbeans, for it to finally run on the command line:

  1. Go to Netbeans project properties, Run tab, and click on Browse against the Main Class textbox.
  2. Select your main class, i.e. the one that contains main(String[] args).
  3. In the project tree, go to Dependencies branch, right-click it, and choose 'Add dependency...'.
  4. Search for maven-jar-plugin. Add it.
  5. Search for maven-assembly-plugin. Add it.
  6. Add the following snippet to the project element of pom.xml manually:
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin
                        <archive>
                            <manifest>
                                <addClasspath>true</addClasspath>
                                <mainClass> com.YourCompany.YourProject.YourMainClass</mainClass>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    
  7. Clean and build.

Until you perform all of the steps, Maven will pretend with a straight face that it has no idea that you expect a runnable JAR as its output. It will made cute faces and assume that all that you want and enjoy is development in your favorite IDE, and that process is the king, whereas results are for losers.

It can't be that bad? It should not be that bad? Yes, this is what you get from the genius degenerates in the FOSS project teams.

Genius is as genius does: as a degenerate.

Let me recap: they have Maven for a build system in order for you to have to manually add obscure dependencies and cryptic XML elements, just to get a working JAR: the stuff we had been getting for free and without any actions on our side, back when Oracle developed Netbeans. So much for FOSS! So much for Apache. Fuck this shit!

Posted by: LinuxLies at 02:48 PM | No Comments | Add Comment
Post contains 363 words, total size 3 kb.




What colour is a green orange?




16kb generated in CPU 0.0088, elapsed 0.0571 seconds.
35 queries taking 0.0528 seconds, 133 records returned.
Powered by Minx 1.1.6c-pink.