From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ITTbHtGacV/YPwAA0tVLHw (envelope-from ) for ; Mon, 28 Sep 2020 08:12:01 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id mCJiGtGacV8IJwAAB5/wlQ (envelope-from ) for ; Mon, 28 Sep 2020 08:12:01 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EC5FC940416 for ; Mon, 28 Sep 2020 08:12:00 +0000 (UTC) Received: from localhost ([::1]:42034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMoGM-00042e-My for larch@yhetil.org; Mon, 28 Sep 2020 04:11:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMoFm-00040p-Nj for emacs-orgmode@gnu.org; Mon, 28 Sep 2020 04:11:22 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:42362) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kMoFk-0002zh-Js for emacs-orgmode@gnu.org; Mon, 28 Sep 2020 04:11:22 -0400 Received: by mail-ed1-x529.google.com with SMTP id j2so285597eds.9 for ; Mon, 28 Sep 2020 01:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:message-id :date:mime-version; bh=BDDXwG0cCpZKgt6vyZOg/prwCxqKf5d62wEJrv/p8Oo=; b=L1aZxzTRsSQSC/GFUsrp3L6GgIvVY7Ugcnh6c2iAYJJFo5mQ33J1irthxYYMvRnQJb k6yV0sXfZE6wg55uzc2MLtLJfSa9CvSPfqmIWD2MSzUXLVn6EHCKfBhJe7Q9HO28L+YZ 7LCwznqgKmaLHgMhyX9BntBBUU/gI0MfBHoFM5c6zZP8y9/ikBQFTwFbfJ2N2Y7ql2DB KnLa8/gPKpBITbBIfq8AbRr1rGA+5sfXV3R6h9Aojuog4w/ESJ78kPNPox1ew6Ko1/g9 pfmx/YyBrNiwezyLWG4tMn5QNM/+nF26KVvYv6JHXtDeO5sMBR3+5V9I92JcdAeOjFsr lVrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=BDDXwG0cCpZKgt6vyZOg/prwCxqKf5d62wEJrv/p8Oo=; b=pObP6dMy3NWErIzggEOSb2pyLcDxRuO/HTR3vX8mAowQ2JselDpOTjv5PRDSN8NWp4 nRXu0EWwYtakUsjaI3tEAN13wjb7m8p4wrfOM32T597JNd9nwjOZzAocbYo3sFiMQebD haeYnkxmjkSoREoW3r9LuUP2LqKL330N0pR4F7bLGYOAhBB8jPqSy7tE7JUNBlLCAWgk 8umQbuINOx0eZ33HdFLlZ34o4QFCsbuVGhdPisecVQOxHOe2UREUJQXOvMEnuPUFDtiP zBoOQbhSOzGKSZlDneyDVLIjRtfcLFsSVOb5x62sskeAe/SP5MBLS9TonN1gKuhW9WXH b4/Q== X-Gm-Message-State: AOAM530ly1x21cUuCj5pmP+eSS4KkR3jg1GA13tnFKJw1xgXsbfFch8x 3OyE13sPO+MbmM78aWTBb3IYP8pdCfChEA== X-Google-Smtp-Source: ABdhPJw2pKf/pkBn7Pa2L/weVKiYLFSCifiZY2C1sANgJWFDlq1NXM5gQclp/Xql/mFsJ0fJRSoWlQ== X-Received: by 2002:a50:fd0a:: with SMTP id i10mr375384eds.277.1601280678059; Mon, 28 Sep 2020 01:11:18 -0700 (PDT) Received: from fnox ([194.132.212.123]) by smtp.gmail.com with ESMTPSA id k13sm345849edj.92.2020.09.28.01.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 01:11:17 -0700 (PDT) References: <87imbyapel.fsf@gmail.com> User-agent: mu4e 1.4.13; emacs 27.1 From: John Herrlin To: ian martins Subject: Re: ob-java compile only In-reply-to: Message-ID: <874knitj6k.fsf@gmail.com> Date: Mon, 28 Sep 2020 10:11:16 +0200 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=jherrlin@gmail.com; helo=mail-ed1-x529.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org-Mode mailing list Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=L1aZxzTR; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.71 X-TUID: B72VppqW5vBj Hey Ian, Thank you for the quick feedback! That workflow seems to work perfectly if it's Java all the way. Then it compiles all the related files. I am mostly working with the classes from Clojure. Here is an example: #+HEADER: :classname se/my_test_package/Hey #+HEADER: :compile-only t #+HEADER: :results none #+HEADER: :dir src #+BEGIN_SRC java package se.my_test_package; public class Hey { public static String hey(String name) { return "Hey " + name; } } #+END_SRC #+BEGIN_SRC clojure :results output code (import [se.my_test_package Hey]) (Hey/hey "John") #+END_SRC Best regards ian martins writes: > Hi John, > > Thanks for the suggestion and patch. Is the reason for this so that you can > have classes without needing dummy "main" methods? > > Did you consider using org-babel-tangle to generate the source files? This > works for me: > > Steps: > 1. put javatangle.org (below) on your local. > 2. create "pkg" directory where javatangle.org is > 3. run org-babel-tangle on javatangle.org (this writes two source files to > the pkg dir) > 4. run C-c C-c on the top source block (this compiles both source files and > runs main) > > ----- javatangle.org ----- > > #+begin_src java :results output :classname pkg/Main :tangle pkg/Main.java > package pkg; > > public class Main { > public static void main(String[] args) { > System.out.println(Hey.hey()); > } > } > #+end_src > > #+begin_src java :results output :classname pkg/Hey :tangle pkg/Hey.java > package pkg; > > public class Hey { > public static String hey() { > return "hey"; > } > } > #+end_src > > > > On Sun, Sep 27, 2020 at 5:19 PM John Herrlin wrote: > >> >> Hey Ian! >> >> Happy to see you as the maintainer of the ob-java! >> >> I would like to propose a feature to ob-java. The feature allows a >> source code block to write and compile only, without executing. >> >> Here is a common use case for me. >> >> Class without a entry point have an :compile-only header. >> >> #+HEADER: :classname se/my_test_package/Hey >> #+HEADER: :dir src >> #+HEADER: :compile-only t >> #+HEADER: :results none >> #+BEGIN_SRC java >> package se.my_test_package; >> >> public class Hey { >> public static String hey(String name) { >> return "Hey " + name; >> } >> } >> #+END_SRC >> >> The provided diff works for my small use case. What do you think? >> >> -- >> Best regards >> John >> >> -- Mvh John