Osiris-Team / 1JPM

1 Java Project Manager, is a Maven/Gradle alternative with a twist. Its a single Java file itself, which should be edited by you to configure your project.
MIT License
197 stars 4 forks source link

fails with "error: can't find main(String[]) method in class: ThisProject" #2

Closed maxandersen closed 2 weeks ago

maxandersen commented 2 weeks ago

java 11 and 17:

java JPM.java
error: can't find main(String[]) method in class: ThisProject

java 21:

java JPM.java
JPM.java:264: warning: [deprecation] URL(String) in URL has been deprecated
        URL url = new URL(mavenRepoUrl + artifactPath);
                  ^
JPM.java:504: warning: [deprecation] URL(String) in URL has been deprecated
            URL url = new URL(mavenMetadataUrl);
                      ^
2 warnings
error: can't find main(String[]) method in class: ThisProject

funny enough if I use jbang it works:

jbang JPM.java build
Resolving dependencies...
maxandersen commented 2 weeks ago

If I add:

 public static void main(String[] args) throws Exception {
        JPM.main(args);
    }

I get a bit further:

java JPM.java build
Resolving dependencies...
Downloading: https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar
Downloading: https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar
Cleaning build directory...
Compiling Java source files...
error: invalid flag: lib/junit-4.13.2.jar
Usage: javac <options> <source files>
use --help for a list of possible options
Exception in thread "main" java.lang.RuntimeException: Command failed with exit code: 2
    at JPM.runCommand(JPM.java:216)
    at JPM$Compile.lambda$new$2e61296f$1(JPM.java:317)
    at JPM$Plugin.execute(JPM.java:116)
    at JPM$Plugin.execute(JPM.java:114)
    at JPM$Project.executeRootTask(JPM.java:159)
    at JPM.main(JPM.java:62)
    at ThisProject.main(JPM.java:41)
Osiris-Team commented 2 weeks ago

Thx for reporting, looking into it 👍

Osiris-Team commented 2 weeks ago

should be fixed in 1.0.3 the "build" task may still not work because it also runs the "test" task which isnt fully developed yet. thus as a workaround run the "jar" task at the moment.