From issues-return-172318-archive-asf-public=cust-asf.ponee.io@maven.apache.org Mon Aug 31 21:24:03 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mxout1-he-de.apache.org (mxout1-he-de.apache.org [95.216.194.37]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id 1E22018063F for ; Mon, 31 Aug 2020 23:24:03 +0200 (CEST) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-he-de.apache.org (ASF Mail Server at mxout1-he-de.apache.org) with SMTP id 662AC63527 for ; Mon, 31 Aug 2020 21:24:02 +0000 (UTC) Received: (qmail 9865 invoked by uid 500); 31 Aug 2020 21:24:01 -0000 Mailing-List: contact issues-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list issues@maven.apache.org Received: (qmail 9831 invoked by uid 99); 31 Aug 2020 21:24:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Aug 2020 21:24:01 +0000 Received: from jira-he-de.apache.org (static.172.67.40.188.clients.your-server.de [188.40.67.172]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 8B54743595 for ; Mon, 31 Aug 2020 21:24:00 +0000 (UTC) Received: from jira-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira-he-de.apache.org (ASF Mail Server at jira-he-de.apache.org) with ESMTP id 0E0CA78015E for ; Mon, 31 Aug 2020 21:24:00 +0000 (UTC) Date: Mon, 31 Aug 2020 21:24:00 +0000 (UTC) From: "Matthew Compton (Jira)" To: issues@maven.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (ARCHETYPE-609) Using common Velocity template breaks with version 3.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Matthew Compton created ARCHETYPE-609: ----------------------------------------- Summary: Using common Velocity template breaks with version 3.= 2.0 Key: ARCHETYPE-609 URL: https://issues.apache.org/jira/browse/ARCHETYPE-609 Project: Maven Archetype Issue Type: Bug Components: Plugin Affects Versions: 3.2.0 Environment: macOS Mojave 10.14.6 Reporter: Matthew Compton Attachments: archetype-fail.tar.gz The recently released version 3.2.0 of the Maven Archetype Plugin has broke= n an archetype I created. I have confirmed my archetype still works with ve= rsion 3.1.2 of the plugin but my team and I normally run {{mvn archetype:ge= nerate ...}}=C2=A0just so we don=E2=80=99t have to specify a particular ver= sion of the plugin, but now Maven will pick up the 3.2.0 version of the plu= gin and fail. I am aware that using {{mvn org.apache.maven.plugins:maven-ar= chetype-plugin:3.1.2:generate ...}}=C2=A0will work around the problem, but = I=E2=80=99d still like to fix my archetype to work with the latest version = of the plugin. The problem appears to be that something has changed with how the class pat= h/resources are setup with the Velocity template engine when rendering temp= lates. I tried looking through the release notes but it just looks like ver= sion numbers were bumped, so I doesn=E2=80=99t seem like this was an intent= ional change in behavior. The source of the problem is my archetype has a common {{META-INF/common-va= riable-definitions.vm}}=C2=A0that contains variables that are used in multi= ple files within the archetype. This worked great with earlier versions of = the archetype plugin, each template that needed the common variable definit= ions simply needed =C2=A0a {{#parse( "META-INF/common-variable-definitions.= vm=E2=80=9D}}=C2=A0) at the top of the file and then all of the usual repla= cements that were needed are available. Now, with the 3.2.0 version of the = plugin I get the following error: {noformat} ... [ERROR] ResourceManager : unable to find resource 'archetype-resources/META= -INF/common-variable-definitions.vm' in any resource loader. [ERROR] #parse(): cannot find template 'archetype-resources/META-INF/common= -variable-definitions.vm', called at archetype-resources/pom.xml[line 1, co= lumn 1] [INFO] --------------------------------------------------------------------= ---- [INFO] BUILD FAILURE [INFO] --------------------------------------------------------------------= ---- [INFO] Total time: =C2=A01.327 s [INFO] Finished at: 2020-08-26T16:28:24-07:00 [INFO] --------------------------------------------------------------------= ---- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plu= gin:3.2.0:integration-test (default-integration-test) on project demo-arche= type:=20 [ERROR] Archetype IT 'basic' failed: Error merging velocity templates: Unab= le to find resource 'archetype-resources/META-INF/common-variable-definitio= ns.vm' [ERROR] -> [Help 1] [ERROR]=20 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e= switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR]=20 [ERROR] For more information about the errors and possible solutions, pleas= e read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecu= tionException{noformat} The issue is that the Velocity engine now expects the common definitions fi= le in {{archetype-resources/META-INF}}=C2=A0instead of a top-level {{META-I= NF}}=C2=A0directory. I tried moving the file to {{archetype-resources/META-= INF/common-variable-definitions.vm}}, but I found that only worked for the = =E2=80=9Cfirst level=E2=80=9D, and it essentially expected that file to cop= ied into every level of the directory hierarchy of the archetype resources = that had templates to render, which makes trying to do this totally pointle= ss, I might as well copy the definitions into the top of each file like I h= ad done in a very early version of my archetype. I also tried using =E2=80= =9C../=E2=80=9C relative paths (like {{#parse( =E2=80=9C../META-INF/common-= variable-definitions.vm=E2=80=9D )}}) in files deeper into the directory hi= erarchy to reference back up to a single common velocity template, but coul= d not get that to work either. Is there something I can do to get this working again with version 3.2.0? O= r is this no something that is actually supported and I was just getting lu= cky before? To help reproduce the problem I created a simple example project to demonst= rate this change in behavior between the two versions of the Maven Archetyp= e Plugin. The top-level {{pom.xml}}=C2=A0in the attach tar has the followin= g properties which you can comment/uncomment to switch between a working an= d failing version. {code:xml} =C2=A0=C2=A0UTF-8 =C2=A0=C2=A0 =C2=A0=C2=A0 =C2=A0=C2=A0 =C2=A0=C2=A03.2.0 {code} If you uncompress the attached tar and call {{mvn clean verify}}=C2=A0you c= an see how it works with 3.1.2 and fails with 3.2.0. -- This message was sent by Atlassian Jira (v8.3.4#803005)