This message was deleted.
# community-support
s
This message was deleted.
v
No, what you do should work fine as far as you showed details.
c
Interesting.
v
Maybe your program detects that no terminal is attached and thus does not produce output or whatever. Hard to guess with that little information 🙂
c
OK, alternative question. I was trying to get a runnable jar so that I could just run it outside of gradle, and added the last section of this file. But it can't be parsed, with an error on "jar {".
Copy code
plugins {
    // This subproject will be an application.
    id 'application'
}


repositories {
    // We will be able to find dependencies here.
    mavenCentral()
}

dependencies {
    // This subproject will be using the musearchtools library (another subproject).
    implementation project(':musearchtools')
    // This subproject will be using the jsoup library.
    implementation 'org.jsoup:jsoup:1.15.3'
    // The tests for this application will use JUnit 4.
    testImplementation 'junit:junit:4.13.2'
}

application {
    mainClass = 'edu.millersville.csci406.spring2023.CrawlerMain'
}

jar {
    manifest {
        attributes {
            'Main-Class': application.mainClass
        }
    }
}
What dumb thing am I doing here?
v
Imho trying to create a runnable jar is already the worst you can try. Especially when you already apply the
application
plugin that can build you a proper distribution.
Just remove the whole
jar
block and use the tasks of the
application
plugin like
distTar
or
distZip
to create a distributable archive with your code, your dependencies, and generated start scripts that properly run your application
c
Ok, thanks, I'll look into that. And just making my application write its data to a file directly instead of standard out.
v
That's also an option, yes.
Btw. regarding the actual last question about the syntax problem, another personal recommendation, use Kotlin DSL. You immediately get type-safe build scripts, proper error messages if you mess up the syntax opposed to Groovy DSL, and amazingly better IDE support if you use a proper IDE like IntelliJ.
Then it would maybe be better obvious that you should have had round parentheses, not curly braces after that
attributes
🙂
c
Thanks, I'll do that too. But as for my immediate needs, I randomly tried adding parenthesis to create
(./gradlew :mucrawer:run 2>&1) | tee crawler.log
and with the parenthesis I am capturing all of the output that I want.
v
Sounds strange. Those parens you show execute the content in a subshell. Maybe your shell is somehow configured to suppress some streams or something like that. (you wouldn't be the first, I've seen it with others before)