microsoft / azure-maven-archetypes

Maven Archetypes for Microsoft Azure Services
MIT License
21 stars 32 forks source link

Generating from archetype fails to populate plugin properties #42

Open jdneo opened 6 years ago

jdneo commented 6 years ago

by @rloutlaw

Plugin name and version

1.11 and 1.12 Maven releases from maven central. Java 8 and Maven 3.5.4.

Plugin configuration in your pom.xml

Relevant failing part:

UTF-8 1.8 1.8 1.0.0-beta-3 1.0.0-beta-4 helloworld-${package.getClass().forName("java.time.LocalDateTime").getMethod("now").invoke(null).format($package.Class.forName("java.time.format.DateTimeFormatter").getMethod("ofPattern", $package.Class).invoke(null, "yyyyMMddHHmmssSSS"))} ${package.getClass().forName("java.lang.StringBuilder").getConstructor($package.getClass().forName("java.lang.String")).newInstance("westus").toString()} ${project.build.directory}/azure-functions/${functionAppName} ${package.getClass().forName("java.lang.StringBuilder").getConstructor($package.getClass().forName("java.lang.String")).newInstance("java-functions-group").toString()}

Expected behavior

The functionAppName, AppRegion, and other fields have proper variable interpolation.

Actual behavior

Fields aren't generated / interpolated properly.

Steps to reproduce the problem

Generate a new project from archtype from Windows command line, Eclipse, or IntellliJ.

jdneo commented 6 years ago

@rloutlaw I'm trying to repro this issue but have no luck. Could you please provide more information?

What's the minor version of Java 8? Did you run it in CMD or bash or powershell?

rloutlaw commented 6 years ago

Java details (from the output of mvn -version)

Java version: 1.8.0_144, vendor: Azul Systems, Inc., runtime: C:\Java\1.8\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

And this was created via a cmd.exe terminal because I like breaking things.

jdneo commented 6 years ago

@rloutlaw

Emm..... Seems we're entering the "works for me" scenario. I installed Azul JDK on my side but cannot repro the issue. Here is my output:

C:\Users\sheche>mvn -v
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00)
Maven home: D:\Tools\apache-maven-3.5.4\bin\..
Java version: 1.8.0_144, vendor: Azul Systems, Inc., runtime: C:\Program Files\Zulu\zulu-8\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

C:\Users\sheche>mvn archetype:generate -DarchetypeGroupId=com.microsoft.azure -DarchetypeArtifactId=azure-functions-archetype
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.0.1:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.0.1:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.0.1:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] Archetype [com.microsoft.azure:azure-functions-archetype:1.12] found in catalog remote
Define value for property 'groupId': test111
Define value for property 'artifactId': test111
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' test111: :
Define value for property 'appName' test111-20180801105408324: :
Define value for property 'appRegion' westus: :
Define value for property 'resourceGroup' java-functions-group: :
Confirm properties configuration:
groupId: test111
artifactId: test111
version: 1.0-SNAPSHOT
package: test111
appName: test111-20180801105408324
appRegion: westus
resourceGroup: java-functions-group
 Y: :
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: azure-functions-archetype:1.12
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: test111
[INFO] Parameter: artifactId, Value: test111
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: test111
[INFO] Parameter: packageInPathFormat, Value: test111
[INFO] Parameter: appName, Value: test111-20180801105408324
[INFO] Parameter: resourceGroup, Value: java-functions-group
[INFO] Parameter: package, Value: test111
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: test111
[INFO] Parameter: appRegion, Value: westus
[INFO] Parameter: artifactId, Value: test111
[INFO] Project created from Archetype in dir: C:\Users\sheche\test111
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.062 s
[INFO] Finished at: 2018-08-01T10:54:09+08:00
[INFO] ------------------------------------------------------------------------
PramodValavala-MSFT commented 6 years ago

@jdneo Unlike @rloutlaw, I don't have this problem when generating from the command line but I do see this issue when generating from eclipse as mentioned here.

It does seem to be an issue with eclipse since it works from the cli but just wanted to confirm.

brunoborges commented 5 years ago

Close?