question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

zerocode custom-archetype

See original GitHub issue

GIVEN the archetype/resources are available WHEN I run the following/similar maven command

mvn archetype:generate -DarchetypeGroupId=<custom-archetype group id e.g.>
    -DarchetypeArtifactId=<custom-archetype artifactid>
    -DarchetypeVersion=<custom-archetype version>
    -DgroupId=<new project Group Id>
    -DartifactId=<new project artifact Id>

THEN I will generate the Zerocode maven project with an example test scenario.

Description

The output of the above command will produce //TODO - structure of the project with a list of Java and resources files. //TODO - attach a sample maven project which is expected as output(.zip file)

- src/main/java
  - com.myproject
    - utils
      - MyUtils.java

- src/test/java
  - com.myproject
     - tests
       - MyGetApiTest.java
       - MyPostApiTest.java
       - MyPutApiTest.java
     - MyApiSuite.java   <----- To run the entire test suite

- src/test/resources
  - tests
     - get_api_200.json
     - post_api_200.json
     - put_api_200.json
  - hostconfig_ci.properties
  - hostconfig_sit.properties

Implementation Help

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kristin-smithcommented, Oct 23, 2019

Hello @authorjapps I’d like to contribute. Is it ok to submit a pull request if it’s assigned already?

1reaction
jneatecommented, Aug 10, 2019

@waqassiddiqi - Great to have you helping!

In addition to the links @authorjapps posted earlier, below are some helpful extra bits if required:

In the archetype-metadata.xml file, if you set “filtered” to true for a file/folder structure then the engine will parse any token starting with a $, if you want to create the archetype with $ symbols which I suspect you will due to the token utilities containing a $ (i.e. ${SYSTEM.PROP:username} then you can do the following:

image

Here I have set a variable named $MONGO_CONNECTION_URI and given it the value ${MONGO_CONNECTION_URI}, this means that when I reference the variable $MONGO_CONNECTION_URI anywhere in the code it will be interpreted and replaced by the value ${MONGO_CONNECTION_URI} in the generated project. Without this approach, the engine would try to parse ${MONGO_CONNECTION_URI} as a variable which wouldn’t work as I have no variables in the project with that name -> Admittedly this isn’t the clearest concept to grasp so do reach out if you have any questions.

If you want to name the files using one of the maven archetype properties you can encase the file with __propertyName__, two underscores before and after the property name, in my example below I created a custom property called entityName and I used the value of that to give the file names meaning: image When the project is generated, the property name is interpreted and transformed to become "ItemApplication.java` if the entityName property was set to Item.

Finally, you can use IF statements inside the maven archetype, in the example below I have another custom property called includeGetById, I check if the value is equal to true and then if it is, I include a line of Java code, this means that if the condition fails, the generated code would not include this line, if the condition equated to true then the line would appear in the generated code, this is useful for complex scenarios.

image

If you need anything else please reach out, good luck!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Archetype Object Model 2 (AOM2) - openEHR Specifications
Introduction of 'tuple' constraints to replace openEHR custom constrainer types for covarying attributes within Quantity, Ordinal structures;.
Read more >
Maven Configuration Issue error | Selenium Forum
The application contains a custom GWT widgetset that is compiled ... 2284: remote -> org.jsmart:zerocode-maven-archetype (Zerocode ...
Read more >
Autify, Provider of AI-Powered, Zero-Code ... - AiThority.com
Allows Javascript input for advanced or custom use scenarios; Can be linked to external services including Slack, Circle CI and TestRail. Read ...
Read more >
Download zerocode-maven-archetype JAR file with all dependencies
Download zerocode-maven-archetype JAR file ✓ With dependencies ✓ Documentation ✓ Source code.
Read more >
Maven Archetype Plugin – archetype:integration-test
Description: Execute the archetype integration tests, consisting in generating projects from the current archetype and optionally comparing ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found