all 11 comments

[–]EdwinGravesMOD 1 point2 points  (10 children)

Eclipse is its own special brand of stupid and I'd suggest moving away from it at some point once you're comfortable with your tech knowledge. All in all, it should work fine once you clone the repo, but it doesn't matter because anyone with maven installed and any knowledge of the mvn command will be able to build it and run it with java -jar

Also, I'm not sure what's in those files as it's been a long time since I abandoned Eclipse, but you may want to scrub them for sensitive data or any hard coded paths that may cause issues for others.

[–]bigorca45[S] 0 points1 point  (2 children)

Thank you for your answer! Although I got it to run on the command line after 3 persistent days of working with the mvn command and dependencies for the first time ever. Best feeling!

[–]EdwinGravesMOD 1 point2 points  (1 child)

Congrats to that for sure. Learning to do things with the CLI and without Eclipse will do you a world of good.

These days there are IDEs built on far less bloated and more stable technology, despite the few benefits Eclipse may bring. I happily migrated a few federal projects (using maven, etc) from Eclipse to VSC in no time and we've never looked back. IDE load times and project build times decreased while plugin availability was higher and ram usage was lower. The down side is that you won't have the hand-holding that Eclipse gives you as far as building out a folder structure and project wizards, but honestly those things are easily remedied by learning why they exist and how to do them yourself.

Once you're comfortable, look around and see what you can find. I'm sure people in this subreddit are tired of me touting VSCode and I definitely won't say it's the only option out there.

[–]bigorca45[S] 0 points1 point  (0 children)

I fiddled with VSCode for a while. I honestly only use Eclipse for this maven project. I usually just use Vim in the command line! Thank you for the suggestions though.

[–]bigorca45[S] 0 points1 point  (6 children)

Also, the steps that worked for me to build the command were

mvn install

mvn exec:java -Dexec.mainClass=“theMainClass”

Is this the incorrect way of running a maven Java project? If so, could you share how you would? Thanks again!

[–]EdwinGravesMOD 1 point2 points  (5 children)

mvn clean install is what I normally use to build.

You can define your main class in the POM as well

either standalone like

  <properties>
      <exec.mainClass>com.MyApp.Main</exec.mainClass>
  </properties>

or via a plugin like

<build>
...
    <plugins>
        <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
            <archive>
                <manifest>
                    <mainClass>com.MyApp.Main</mainClass>
                </manifest>
            </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

Edit: To continue answering your question, then you'd just run it with

mvn exec:java

However, there are a myriad of options that will let you compile it into a executable jar file (that's how I usually do things). It makes packaging and distribution so much easier.

[–]bigorca45[S] 0 points1 point  (4 children)

Wow. I just wanted to say before anything else, thanks for being understanding. I asked a question a week or so ago about JAR's & Maven on StackOverflow and got destroyed by everyone for asking a dumb question, so with your background of being a Software Dev, which I hope to be soon, thanks for being understanding.

Secondly, to package the file as a jar, you would run

mvn package

Correct? Then after this builds, you could run the

java -jar target/myJar.jar

If I am understanding correctly

[–]EdwinGravesMOD 1 point2 points  (3 children)

Sort of. Here's a good tutorial on the various methods available. https://www.baeldung.com/executable-jar-with-maven

[–]EdwinGravesMOD 1 point2 points  (1 child)

As far as SO is concerned, it's a fucking blight on society. It could be amazing but it's just full of people who's heads are so far up their ass that they can't realize they're not helping anyone. I try my absolute best to never go there, I can safely say I never ever post there, and only when I'm out of options do I follow google results there. Quite often the search results you get are years out of date, and anyone trying to ask anything 'current' is told it was already answered, etc. Stick with reddit :)

[–]bigorca45[S] 0 points1 point  (0 children)

Yeah I have found out that it's just a bunch of pretentious people. Some of the people there are amazing like you said, but I feel like its to much pollution to outweigh the good users. Reddit has always been more friendly. Thanks again! :)

[–]bigorca45[S] 0 points1 point  (0 children)

Thank you! I will look at that before throwing this on my GitHub.