From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id 706083986415 for ; Thu, 5 Aug 2021 05:43:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 706083986415 Received: by mail-ot1-x32f.google.com with SMTP id c2-20020a0568303482b029048bcf4c6bd9so4034045otu.8 for ; Wed, 04 Aug 2021 22:43:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=cIM86Qrz2CzOutp97zcZLo8gTPH86eJymNwOU3iFrVE=; b=BKAlUeWhJAidjoxdirssOQ8dmghcXV9kaxTtfj4J4CIbTUTo3gY2BmG2aNZexJHtp4 sAOSTLXziRtmjTq7KetvrVYgaB/GtVL6PcVaKv0TIxxSEyUdZ/CKhgfIwaYKOOk47bHA W4dGxcHWsT8z7JbWuk5W38OweITfK+OIBrVXmJGwFODf4VI2D62O/3cSH8V0XGRktaeI OtQ3wCvaBVuVvTJteIcZDBbvtUxqzosILSeHMpfMyhSNIW46+LlzKoPfvEyt+tVPXGMc LmCY2RUUBoZhbysaN2YWtwvbieRb8aNce7MEcRyGTVCikO+tee9fuML+3dmzulbFCBqJ IfWA== X-Gm-Message-State: AOAM531eTkEmiublUiQWq3+LyveIQi+nxPZo1LgZ7B1eVZc6fla3QIXM j2SwH1Q2NmZiXhcHh3FHn5I= X-Google-Smtp-Source: ABdhPJyNvCoDj3+UO8m9ugG56LoT9+vMZxVRpy2rwE7T7MP5j//gOw+QbTSA/kGpfqQBF1UA2yKoJg== X-Received: by 2002:a9d:6142:: with SMTP id c2mr2401623otk.331.1628142234743; Wed, 04 Aug 2021 22:43:54 -0700 (PDT) Received: from L440 ([189.217.11.155]) by smtp.gmail.com with ESMTPSA id j20sm652863oos.13.2021.08.04.22.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 22:43:53 -0700 (PDT) Received: by L440 (Postfix, from userid 1000) id 5591818E7EDA; Thu, 5 Aug 2021 00:43:52 -0500 (CDT) From: Alcides Flores Pineda To: Phil Eaton Cc: kawa@sourceware.org Subject: Re: Example of importing a jar (from ~/.m2/repository) References: Date: Thu, 05 Aug 2021 00:43:52 -0500 In-Reply-To: (Phil Eaton's message of "Wed, 4 Aug 2021 20:21:07 -0400") Message-ID: <87zgtwv42v.fsf@L440.i-did-not-set--mail-host-address--so-tickle-me> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: kawa@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Kawa mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 05:43:57 -0000 Hi Phil: If you are just running Kawa from the command line and all that you want is to use/test some library (from a local Maven repository or not) in the Kawa REPL, then you can just copy or symlink all the needed JAR files, (including `kawa.jar`) into a specific directory, and then tell java to run them from there.=20 For example, suppose I want to use the Apache Commons Codec library from my local Maven repo ($HOME/.m2/repository) in a Kawa REPL, then, what I do is the following: 1. I copy or symlink the required file along with `kawa.jar`) ($HOME/.m2/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.j= ar) into a directory (say for example $HOME/lib). 2. From there run as: cd $HOME/lib java -cp $HOME/lib/commons-codec-1.10.jar:$HOME/lib/kawa.jar kawa.repl 3. Now I can use the DigestUtils class from the Kawa repl as: #|kawa:1|# (import (class org.apache.commons.codec.digest DigestUtils)) #|kawa:2|# (DigestUtils:md5-hex "mystring") 169319501261c644a58610f967e8f9d0 The same stuff applies if you want to run/use it from a Kawa scheme script. On the other side, if you need/want to use more than a library/JAR (say=20 a framework like Spring) with Kawa in a Maven project and run it from=20 there, then I suggest you to do the following: 1. Use the Kawa Maven plugin that Arvydas wrote last year to compile your Kawa scheme files: * https://github.com/arvyy/kawa-maven-plugin 2. Configure your POM (pom.xml) in such a way that it uses the desired libraries/dependencies and the `kawa.jar` to compile and run your Kawa s= cheme files, for example with the Maven Ant-Run plugin and the Exec Maven plug= in. Greetings. --=20 Alcides Flores Pineda. El mi=C3=A9, ago 04 2021, Phil Eaton escribi=C3=B3: > Hey folks, > > New to Java and Kawa. I'm trying to import a web server library that I > installed through maven. > > The minimal program I'm running is this (test.scm): > > (import (class io.jooby Context)) > > > And I run it by making all maven jars available in the CLASSPATH: > > CLASSPATH=3D"$(find ~/.m2/repository -name '*.jar' | paste -sd ';');." ka= wa > test.scm > > > But I get: > > test.scm:2:16: no class found named io.jooby.Context > > > The io.jooby:jooby jar is > at ~/.m2/repository/io/jooby/jooby/2.10.0/jooby-2.10.0.jar. > > What more should I do for Kawa to find the class? > > Thanks! > Phil