rife2/bld

[1.9.1] better exception message

hrstoyanov opened this issue · 4 comments

I had a pice of Builder code like this:

public class Build extends BaseProject {
    ...
    public Build() {
        r//epositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
        ..
    }

It turns out that I had to explicitly configure the repositories, despite that I had this in my bld-wrpapper.properties:

bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL

Is this my mistake, assuming that the config repos will flow in my Build object? What happens when I do not set the repositories properly, is shown below. However, it would have been much better if the error also spelled out the repos it was given - I would have notice immediately that the repositories config was empty.

So, please improve the eror message to include the repositories list.

hristo:~$./bld -s helidon-download
rife.bld.dependencies.exceptions.ArtifactNotFoundException: Couldn't find artifact for dependency 'io.helidon.http:helidon-http:4.0.8' at 
        at rife.bld.dependencies.DependencyResolver.getMavenPom(DependencyResolver.java:417)
        at rife.bld.dependencies.DependencyResolver.getAllDependencies(DependencyResolver.java:126)
        at rife.bld.dependencies.DependencyScopes.resolveScopedDependencies(DependencyScopes.java:147)
        at rife.bld.dependencies.DependencyScopes.resolveCompileDependencies(DependencyScopes.java:75)
        at rife.bld.operations.DownloadOperation.executeDownloadCompileDependencies(DownloadOperation.java:60)
        at rife.bld.operations.DownloadOperation.execute(DownloadOperation.java:44)
        at rife.bld.operations.AbstractOperation.executeOnce(AbstractOperation.java:75)
        at rife.bld.BaseProject.download(BaseProject.java:499)
        at peruncs.shared.Build.downloadHelidon(Build.java:81)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at rife.bld.CommandAnnotated.execute(CommandAnnotated.java:27)
        at rife.bld.BuildExecutor.executeCommand(BuildExecutor.java:454)
        at rife.bld.BuildExecutor.execute(BuildExecutor.java:230)
        at rife.bld.BaseProject.execute(BaseProject.java:1679)
        at rife.bld.BuildExecutor.start(BuildExecutor.java:274)
        at peruncs.shared.Build.main(Build.java:19)
  • The repositories defined in the wrapper's properties are for bld own use (to download extensions, etc.)
  • The repositories needed by your projects should always be defined in the build file.

That's why the bld dependencies are placed in the lib/bld directory, and not shared with the project.

How to set up dependencies for your project is clearly explained in the documentation.

The wrapper's properties file usage is explained here.

Contrary to Maven or Gradle, bld does not use project configuration files, everything is done in the build file.

Hope this helps.

Thanks @ethauvin ! I was only hoping for a better error message, one that spells out the repositories searched. If I saw an empty list, that would have alerted me much faster to where the problem was.

The locations were already listed in the exception message, however if they were empty they were just blank. I improved the message to take that into account.

Thank you @gbevin , the change looks good!