You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2019/12/26 08:25:50 UTC

[GitHub] [servicecomb-toolkit] chanjarster commented on a change in pull request #74: [SCB-1679] adjust main class package

chanjarster commented on a change in pull request #74: [SCB-1679] adjust main class package
URL: https://github.com/apache/servicecomb-toolkit/pull/74#discussion_r361399513
 
 

 ##########
 File path: codegen/src/main/java/org/apache/servicecomb/toolkit/codegen/AbstractJavaCodegenExt.java
 ##########
 @@ -46,7 +47,17 @@ public AbstractJavaCodegenExt() {
     apiPackage = groupId + "." + artifactId + ".api";
     modelPackage = groupId + "." + artifactId + ".model";
     mainClassPackage = groupId + "." + artifactId;
+  }
 
+  @Override
+  public void processOpts() {
+    super.processOpts();
+    if (StringUtils.isEmpty((String) additionalProperties.get("mainClassPackage"))) {
+      mainClassPackage = apiPackage.substring(0, apiPackage.lastIndexOf("."));
+      additionalProperties.put("mainClassPackage", mainClassPackage);
+    } else {
+      mainClassPackage = (String) additionalProperties.get("mainClassPackage");
+    }
 
 Review comment:
   You need to write a unit test for this logic.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services