Cannot get Custom Field working

I create a new plugin using atlas-create-jira-plugin. The application then runs correctly with atlas-run. When I try to add a custom field using atlas-create-jira-plugin-module, run the application again, and go to Manage Addons, Jira reports that “The module is broken”. The same problem continues if I edit the custom field class with the contents proved in this tutorial.

Hi, @teddy.koker.

I tried it just now and was not able to experience any errors.

Here are the steps I did:

  1. atlas-create-jira-plugin
  2. atlas-run; it works
  3. shut the instance down
  4. atlas-create-jira-plugin-module then selected 4
  5. atlas-run; so far no error

I used the following versions in my pom:

  • Jira version: 7.2.2
  • AMPS version 6.2.11

Are there any other steps taken that may help us replicate the issue?

Cheers!
Ian

Hey @iragudo,
Thanks for the help! I am using the following versions:

  • Jira 7.5.0
  • Atlas 6.3.6

I follow the steps exactly as you did. When I first go to manage add-ons, there seems to be no problem. However, once I go Administation → Issues → Custom Fields → Add Custom Field → Advanced, the new field that I made using atlas-create-jira-plugin-module with option 4 is not there, and if I navigate back to Manage Add-ons it shows the module as broken:

I hope this helps clarify my issue. Thanks so much for the help!
Teddy

@teddy.koker this is an interesting case we have here. I created a setup just like the version you’ve mentioned, re-run the following steps and I got a successful custom field still.

When I shutdown the instance, I always use ctrl + d for a graceful shutdown.

Edit:
I was able to replicate the issue. If you opted for ctrl + C when shutting down the instance, then running it again, I hit the issue you encountered. To fix that, call atlas-mvn clean prior to invoking atlas-run again.

By the way, this is the option 4 I mentioned during atlas-create-jira-plugin-module

Hope this helps!

@iragudo I tried running atlas-mvn-clean and then atlas-run and I am still having the same problem. I get the same image as you until I try to add a custom field on the Jira website, in which I cannot find the field I made. Afterwards I get the broken module error. I have tried the following in addition:

  1. atlas-create-jira-plugin
  2. atlas-run and then Ctrl-D
  3. atlas-create-jira-plugin-module option 4, all default
  4. atlas-run
  5. Navigate to Administation -> Issues -> Custom Fields -> Add Custom Field -> Advanced
    • My Custom Field is not there
  6. Navigate to Administation -> Addons -> Manage Addons
    • Broken module

And even without running it in between creation:

  1. atlas-create-jira-plugin
  2. atlas-create-jira-plugin-module option 4, all default
  3. atlas-run
  4. Navigate to Administation -> Issues -> Custom Fields -> Add Custom Field -> Advanced
    • My Custom Field is not there
  5. Navigate to Administation -> Addons -> Manage Addons
    • Broken module

Maybe I am just missing something? Thanks

Apologies for the misunderstanding on my end @teddy.koker. I see what you mean, I was focused on the “This module is broken” error.

In the MyCustomField class, there are some missing annotations and fields in the tutorial. I modified the first few parts as follows to make it work. Do note of @Scanned, @ComponentImport, and @Inject so that the wiring should be done properly.

@Scanned
public class MyCustomField extends TextCFType {
	private static final Logger log = LoggerFactory.getLogger(MyCustomField.class);
	
	@ComponentImport
	private final CustomFieldValuePersister customFieldValuePersister;
	
	@ComponentImport
	private final GenericConfigManager genericConfigManager;

	@Inject
	public MyCustomField(CustomFieldValuePersister customFieldValuePersister,
			GenericConfigManager genericConfigManager) {
		super(customFieldValuePersister, genericConfigManager);
		this.customFieldValuePersister = customFieldValuePersister;
		this.genericConfigManager = genericConfigManager;
	}

I have verified and now it appears in the Custom Fields when you want to add it.

Kindly try it out and tell us how it goes. Thanks

@iragudo Thanks! That worked! Is there documentation on required modifications so things like this do not happen in the future? Thanks again

@teddy.koker glad to know it worked for you. Kindly mark the answer so that other people facing the same problem know how to approach it, thank you.

Regarding the documentation, I raised the documentation issue you faced for it to be addressed.

Have a nice day.