@@ -0,0 +1,2649 @@
+/*%0A * See the NOTICE file distributed with this work for additional%0A * information regarding copyright ownership.%0A *%0A * This is free software; you can redistribute it and/or modify it%0A * under the terms of the GNU Lesser General Public License as%0A * published by the Free Software Foundation; either version 2.1 of%0A * the License, or (at your option) any later version.%0A *%0A * This software is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU%0A * Lesser General Public License for more details.%0A *%0A * You should have received a copy of the GNU Lesser General Public%0A * License along with this software; if not, write to the Free%0A * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA%0A * 02110-1301 USA, or see the FSF site: http://www.fsf.org.%0A */%0Apackage org.xwiki.tool.extension;%0A%0Aimport java.io.File;%0A%0Aimport org.apache.maven.plugin.MojoExecutionException;%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;%0Aimport org.xwiki.tool.extension.util.AbstractExtensionMojo;%0A%0A/**%0A * Generate complete extension descriptor for current artifact.%0A *%0A * @version $Id$%0A * @since 8.4%0A */%0A@Mojo(name = %22register%22, defaultPhase = LifecyclePhase.GENERATE_RESOURCES, requiresDependencyResolution = ResolutionScope.RUNTIME, requiresProject = true, threadSafe = true)%0Apublic class RegisterMojo extends AbstractExtensionMojo%0A%7B%0A    /**%0A     * The directory where the war is generated.%0A     */%0A    @Parameter(defaultValue = %22$%7Bproject.build.outputDirectory%7D%22, required = true)%0A    private File outputDirectory;%0A%0A    /**%0A     * The maven project.%0A     */%0A    @Parameter(defaultValue = %22$%7Bproject%7D%22, required = true, readonly = true)%0A    protected MavenProject project;%0A%0A    @Override%0A    public void execute() throws MojoExecutionException%0A    %7B%0A        initializeComponents();%0A%0A        // Register the WAR%0A        register();%0A    %7D%0A%0A    private void register() throws MojoExecutionException%0A    %7B%0A        // Make sure %22/META-INF/%22 exists%0A        File directory = new File(this.outputDirectory, %22META-INF%22);%0A        directory.mkdirs();%0A%0A        // Write descriptor%0A        try %7B%0A            saveExtension(new File(directory, %22extension.xed%22), this.project.getModel());%0A        %7D catch (Exception e) %7B%0A            throw new MojoExecutionException(%22Failed to write WAR descriptor%22, e);%0A        %7D%0A    %7D%0A%7D%0A

Introduce Maven plugin to generate extension descriptos in a WAR