4 Replies Latest reply on Nov 7, 2016 9:16 AM by Mylos Kathos

    Developing a simple Add-on

    Mylos Kathos Master

      Hi all,

      I'd like to develop a basic add-on which will let me customize my web application web.xml by including automatically security constraints, taken from user input. So far I've found an example which adds libraries to your pom.xml through the DependencyInstaller and DependencyResolver.


      public class HelloWorldUICommand extends AbstractProjectCommand {
          @Inject ProjectFactory projectFactory;
          @Inject @WithAttributes(label = "Name", required = true, description = "Enter your name")  
          UIInput<String> input;
          @Inject DependencyInstaller dependencyInstaller;
          @Inject DependencyResolver dependencyResolver;    
          @Inject @WithAttributes(label = "Version", required = true, description = "Select the version of PicketLink") 
          private UISelectOne<Coordinate> version;    
          public void initializeUI(UIBuilder builder) throws Exception {
              DependencyQuery query = DependencyQueryBuilder
                      .setFilter(new NonSnapshotDependencyFilter());
              List<Coordinate> coordinates = dependencyResolver.resolveVersions(query);
          public Result execute(UIExecutionContext context) throws Exception {
              DependencyBuilder builder = DependencyBuilder.create();
              dependencyInstaller.install(getSelectedProject(context), builder);
              return Results.success("Hello World");
          protected boolean isProjectRequired() {
              return true;
          protected ProjectFactory getProjectFactory() {
              return projectFactory;

      I wonder if there is also a specific class to modify a web project's XML files, or any other way to customize it from the add-on.

      Many thanks