Return-Path: X-Original-To: apmail-maven-users-archive@www.apache.org Delivered-To: apmail-maven-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7EA221905A for ; Tue, 22 Mar 2016 07:35:39 +0000 (UTC) Received: (qmail 23073 invoked by uid 500); 22 Mar 2016 07:35:38 -0000 Delivered-To: apmail-maven-users-archive@maven.apache.org Received: (qmail 22983 invoked by uid 500); 22 Mar 2016 07:35:38 -0000 Mailing-List: contact users-help@maven.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Maven Users List" Reply-To: "Maven Users List" Delivered-To: mailing list users@maven.apache.org Received: (qmail 22971 invoked by uid 99); 22 Mar 2016 07:35:38 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Mar 2016 07:35:38 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 9099F180457 for ; Tue, 22 Mar 2016 07:35:37 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.198 X-Spam-Level: * X-Spam-Status: No, score=1.198 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 3isyeFET_E0n for ; Tue, 22 Mar 2016 07:35:35 +0000 (UTC) Received: from mail-pf0-f174.google.com (mail-pf0-f174.google.com [209.85.192.174]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id A2B815F23A for ; Tue, 22 Mar 2016 07:35:34 +0000 (UTC) Received: by mail-pf0-f174.google.com with SMTP id 4so167619744pfd.0 for ; Tue, 22 Mar 2016 00:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=UQBTlbxWgEXlhnkKAf0W6uPg0tTWgDVbi6Jh1U0UlyQ=; b=mU+jnAuR64Qh9UcFIGUcfABs3PZYrZx0cZLF8DOHYwtQRhDiZ5PWo1aKM83Kxk2x28 qFfO1JCfjK4J+o80RyUsvXVAtOT/DLj7T86MNCIklUh1OLo959wIFmp+lh8Xy95p7OE8 3wPQyq9EDGE8U+nCBlVUk+x8BR1Q+kqjILL/GT6IrAL4jsn4CDAZFdWNcwsNoXUYaYWT P2vttT1BbuQ8i3wdY0sxUuKv1DRF0jTVflZZ8Jr1ceJe6QYeStKw2x6U2awlGUQgqdVS a0+MeSFkgnxH3H/pUGlS4M9lcQ0HSo4zbxY9EbCWeJQY/Mm8EvZHPy9v9niugeaYEGWA fqsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=UQBTlbxWgEXlhnkKAf0W6uPg0tTWgDVbi6Jh1U0UlyQ=; b=CMn1437vmdimfGhjkM7Dko4jgef0N8HLQuPrKTm1/hVfYNRTLSgb6mPjENPEuCCYLB 3hn3emZWNxi7niLHvhYfEE1rTqgJHYhYEEsy/mUHlXeYWnCa2pWd6y6X0bzSuJPSwAiE bXM5NBYbfVAvmYda1jYDmSR/CEUWQs8VrxlZJd8bOTnKF0VZ7kSoEd+TVmrhT+aXgM91 /lHE1BOITVSXUFjH/ti0jAP+kB+7qaZy8BSewPpij8X9aQH7nczof5yrtkAg2QIWZiYE Y5bveNcdh25OLxBPhqgbcIx6nTxkySaovM1nbecKB4nvjuF03eNmSCeJ+my+OUmXm72F 8kVg== X-Gm-Message-State: AD7BkJJVVM5cxA0o1ozhXU2oL8rxkzL/9K1b30J1SwziRUcLmkKw6Pej4JBFiGI5N+Zs2uYW7wJjpG7rL21UjA== MIME-Version: 1.0 X-Received: by 10.98.10.74 with SMTP id s71mr44275910pfi.86.1458632133343; Tue, 22 Mar 2016 00:35:33 -0700 (PDT) Received: by 10.66.161.1 with HTTP; Tue, 22 Mar 2016 00:35:33 -0700 (PDT) In-Reply-To: References: Date: Tue, 22 Mar 2016 08:35:33 +0100 Message-ID: Subject: Re: Post processing generated sources From: =?UTF-8?Q?Jens_Teglhus_M=C3=B8ller?= To: Maven Users List Content-Type: multipart/alternative; boundary=001a11428e0e2a82df052e9e42a3 --001a11428e0e2a82df052e9e42a3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I think most plugins that generate source code add the target folders as source folders themselves. My current problem is to compile and run the rewrite code as part of the generate-sources phase. What I have right now is the following antrun invocation: org.apache.maven.plugins maven-antrun-plugin 1.8 com.sun tools 1.5.0 system ${env.JAVA_HOME}/lib/tools.jar pre-process-generated-classes generate-sources run true So I gave src/rewrite-generated-code/java/RewriteGeneratedClasses.java which I compile and execute through antrun. It reads the generated code in target/generated-sources/jsonschema2pojo massages it a big and writes it back to the same file. It actually works fine, but I'm a bit unsure if it is just too complex, I will probably not understand it myself in a week and the rest of the dev-team will hunt me down with pitchforks if they have to maintain it one day. Best regards Jens On Mon, Mar 21, 2016 at 12:50 PM, Jeff MAURY wrote: > You can generate in any folder (under target) but you must add this folde= r > to the list of source directories so that the maven compiler will process > them > This can be done with the maven API if you have your own Maven plugin or > with the build-helper-plugin > > Jeff > Le 21 mars 2016 12:45, "Jens Teglhus M=C3=B8ller" a = =C3=A9crit : > > > Thanks for the short and precise answer. > > > > Any guidelines as how to organize the code that performs the processing= . > > Should I create a new directory in src separate from main and test i.e. > > preprocess and compile it to target/preprocess-classes? > > > > Best regards Jens > > > > And where should i put my source that does the post processing should i > > create my own > > > > On Mon, Mar 21, 2016 at 12:29 PM, Jeff MAURY > wrote: > > > > > Generate-sources > > > > > > Jeff > > > Le 21 mars 2016 12:25, "Jens Teglhus M=C3=B8ller" = a > > =C3=A9crit : > > > > > > > Hi > > > > > > > > I'm generating java sources (using jsonschema2pojo and > > jaxb2-maven-plugin > > > > plugin) and I would like to do some post processing on the generate= d > > > source > > > > files before compiling them (like have some of the generated files > > > > implement certain interfaces, perhaps using roaster). > > > > > > > > I'm a bit unsure which phase I should do that in and if I do it wit= h > > > > roaster I will have probably have a few java files that I would nee= d > to > > > > compile and run on the source files (I would prefer not to p=C3=A5 = that > in a > > > > separate project). It could probably be done quite easily with > > > > maven-antrun-plugin but I'm but I'm interested to know if there is = a > > > smart > > > > way to do it. > > > > > > > > Best regards Jens > > > > > > > > > > --001a11428e0e2a82df052e9e42a3--