@@ -0,0 +1,3374 @@
+package org.jboss.shamrock.maven;%0A%0Aimport java.io.File;%0Aimport java.io.FileOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.nio.charset.StandardCharsets;%0Aimport java.nio.file.Files;%0Aimport java.util.Map;%0Aimport java.util.Properties;%0Aimport java.util.TreeMap;%0Aimport java.util.zip.ZipEntry;%0Aimport java.util.zip.ZipFile;%0A%0Aimport org.apache.maven.artifact.Artifact;%0Aimport org.apache.maven.plugin.AbstractMojo;%0Aimport org.apache.maven.plugin.MojoExecutionException;%0Aimport org.apache.maven.plugin.MojoFailureException;%0Aimport org.apache.maven.plugins.annotations.LifecyclePhase;%0Aimport org.apache.maven.plugins.annotations.Mojo;%0Aimport org.apache.maven.plugins.annotations.Parameter;%0Aimport org.apache.maven.plugins.annotations.ResolutionScope;%0Aimport org.apache.maven.project.MavenProject;%0A%0A@Mojo(name = %22create-example-config%22, defaultPhase = LifecyclePhase.NONE, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)%0Apublic class ExampleConfigMojo extends AbstractMojo %7B%0A%0A%0A    @Parameter(defaultValue = %22$%7Bproject%7D%22, readonly = true, required = true)%0A    protected MavenProject project;%0A%0A%0A    @Override%0A    public void execute() throws MojoExecutionException, MojoFailureException %7B%0A        try %7B%0A            File out = new File(project.getBasedir(), %22src/main/resources/META-INF/example-microprofile-config.properties%22);%0A            out.getParentFile().mkdirs();%0A%0A            Properties properties = new Properties();%0A            for (Artifact a : project.getArtifacts()) %7B%0A                if (!%22jar%22.equals(a.getType())) %7B%0A                    continue;%0A                %7D%0A                try (ZipFile zip = openZipFile(a)) %7B%0A                    ZipEntry deps = zip.getEntry(%22META-INF/shamrock-descriptions.properties%22);%0A                    if (deps != null) %7B%0A                        try (InputStream in = zip.getInputStream(deps)) %7B%0A                            properties.load(in);%0A                        %7D%0A                    %7D%0A%0A                %7D%0A            %7D%0A            StringBuilder sb = new StringBuilder(%22Example shamrock config%5Cn%5Cn%22);%0A            for(Map.Entry%3CObject, Object%3E e : new TreeMap%3CObject, Object%3E( properties).entrySet()) %7B%0A                sb.append(%22# %22)%0A                        .append(e.getValue().toString().replace(%22%5Cn%22, %22 %22))%0A                        .append(%22%5Cn#%22)%0A                        .append(e.getKey())%0A                        .append(%22=%5Cn%5Cn%22);%0A            %7D%0A            getLog().error(%22Creating example File at %22 + out);%0A            try(FileOutputStream f = new FileOutputStream(out)) %7B%0A                f.write(sb.toString().getBytes(StandardCharsets.UTF_8));%0A            %7D%0A        %7D catch (Exception e) %7B%0A            throw new MojoExecutionException(%22Failed to generate config%22, e);%0A        %7D%0A%0A%0A    %7D%0A%0A    private ZipFile openZipFile(final Artifact a) %7B%0A        final File file = a.getFile();%0A        if (file == null) %7B%0A            throw new RuntimeException(%22No file for Artifact:%22 + a.toString());%0A        %7D%0A        if (!Files.isReadable(file.toPath())) %7B%0A            throw new RuntimeException(%22File not existing or not allowed for reading: %22 + file.getAbsolutePath());%0A        %7D%0A        try %7B%0A            return new ZipFile(file);%0A        %7D catch (IOException e) %7B%0A            throw new RuntimeException(%22Error opening zip stream from artifact: %22 + a.toString());%0A        %7D%0A    %7D%0A%0A%7D%0A

Add ability to generate example config