plexus-maven-plugin-1.3.8/0000755000175000017500000000000011121276713015402 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/0000755000175000017500000000000011121276713016171 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/test/0000755000175000017500000000000011121276712017147 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/test/resources/0000755000175000017500000000000011121276712021161 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/test/resources/projects/0000755000175000017500000000000011121276712023012 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/0000755000175000017500000000000011121276712024676 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/src/0000755000175000017500000000000011121276712025465 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/src/main/0000755000175000017500000000000011121276712026411 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/src/main/java/0000755000175000017500000000000011121276712027332 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/src/main/java/org/0000755000175000017500000000000011121276712030121 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/src/main/java/org/codehaus/0000755000175000017500000000000011121276712031714 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/src/main/java/org/codehaus/plexus/0000755000175000017500000000000011121276712033234 5ustar twernertwerner././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootplexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/src/main/java/org/codehaus/plexus/component/plexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/src/main/java/org/codehaus/plexus/c0000755000175000017500000000000011121276712033377 5ustar twernertwerner././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootplexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/src/main/java/org/codehaus/plexus/component/Hello.javaplexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/src/main/java/org/codehaus/plexus/c0000644000175000017500000000021710565423462033410 0ustar twernertwernerpackage org.codehaus.plexus.component; public interface Hello { final static String ROLE = Hello.class.getName(); void sayHello(); }././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootplexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/src/main/java/org/codehaus/plexus/component/HelloImpl.javaplexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/src/main/java/org/codehaus/plexus/c0000644000175000017500000000052610565423462033413 0ustar twernertwernerpackage org.codehaus.plexus.component; /** * @plexus.component */ public class HelloImpl implements Hello { /** * @plexus.configuration expression="${expression}" default-value="Hello World!" * @required */ private String message; public void sayHello() { System.out.print( message ); } }plexus-maven-plugin-1.3.8/src/test/resources/projects/project-01/pom.xml0000644000175000017500000000160610536361003026213 0ustar twernertwerner 4.0.0 plexus-maven-test plexus-maven-plugin-test 0.1 Plexus Maven Plugin Test org.codehaus.plexus plexus-maven-plugin true descriptor plexus-maven-plugin-1.3.8/src/main/0000755000175000017500000000000011121276713017115 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/main/java/0000755000175000017500000000000011121276712020035 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/main/java/org/0000755000175000017500000000000011121276712020624 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/0000755000175000017500000000000011121276712022417 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/0000755000175000017500000000000011121276712023737 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/0000755000175000017500000000000011121276712025045 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/0000755000175000017500000000000011121276713026344 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/report/0000755000175000017500000000000011121276713027657 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/report/Requirements.java0000644000175000017500000000555410700074416033214 0ustar twernertwerner/* * The MIT License * * Copyright (c) 2006, The Codehaus * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.codehaus.plexus.maven.plugin.report; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.codehaus.doxia.sink.Sink; import org.jdom.Element; /** * @author Trygve Laugstøl * @version $Id: Requirements.java 6925 2007-10-01 04:35:26Z user57 $ */ public class Requirements { private List requirements = new ArrayList(); public Requirements( Element element ) { for ( Iterator it = element.getChildren( "requirement" ).iterator(); it.hasNext(); ) { Element requireqment = (Element) it.next(); requirements.add( new Requirement( requireqment ) ); } } public void print( Sink sink ) { if ( requirements.size() == 0 ) { return; } /* sink.section4(); sink.sectionTitle4(); sink.text( "Requirements" ); sink.sectionTitle4_(); sink.section4_(); sink.paragraph(); for ( Iterator it = requirements.iterator(); it.hasNext(); ) { Requirement requirement = (Requirement) it.next(); requirement.print( sink ); } sink.paragraph_(); */ // sink.section4(); // sink.sectionTitle4(); // sink.text( "Requirements" ); // sink.sectionTitle4_(); // sink.section4_(); sink.paragraph(); sink.table(); sink.tableCaption(); sink.text( "Requirements" ); sink.tableCaption_(); for ( Iterator it = requirements.iterator(); it.hasNext(); ) { Requirement requirement = (Requirement) it.next(); requirement.print( sink ); } sink.table_(); sink.paragraph_(); } } plexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/report/Requirement.java0000644000175000017500000000656010700074416033027 0ustar twernertwerner/* * The MIT License * * Copyright (c) 2006, The Codehaus * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.codehaus.plexus.maven.plugin.report; import org.codehaus.doxia.sink.Sink; import org.codehaus.plexus.util.StringUtils; import org.jdom.Element; /** * @author Trygve Laugstøl * @version $Id: Requirement.java 6925 2007-10-01 04:35:26Z user57 $ */ public class Requirement { private String role; private String roleHint; private String fieldName; public Requirement( Element requireqment ) { role = requireqment.getChildTextTrim( "role" ); roleHint = requireqment.getChildTextTrim( "roleHint" ); fieldName = requireqment.getChildTextTrim( "fieldName" ); } public String getRole() { return role; } public String getRoleHint() { return roleHint; } public String getFieldName() { return fieldName; } public void print( Sink sink ) { /* sink.text( "Role: " + role ); sink.lineBreak(); if( StringUtils.isNotEmpty( roleHint ) ) { sink.text( "Role hint: " + roleHint ); sink.lineBreak(); } if( StringUtils.isNotEmpty( fieldName ) ) { sink.text( "Field name: " + fieldName ); sink.lineBreak(); } */ sink.tableRow(); sink.tableCell(); sink.text( "Role" ); sink.tableCell_(); sink.tableCell(); sink.monospaced(); sink.text( role ); sink.monospaced_(); sink.tableCell_(); sink.tableRow_(); if( StringUtils.isNotEmpty( roleHint ) ) { sink.tableRow(); sink.tableCell(); sink.text( "Hint" ); sink.tableCell_(); sink.tableCell(); sink.monospaced(); sink.text( roleHint ); sink.monospaced_(); sink.tableCell_(); sink.tableRow_(); } if( StringUtils.isNotEmpty( fieldName ) ) { sink.tableRow(); sink.tableCell(); sink.text( "Field name" ); sink.tableCell_(); sink.tableCell(); sink.monospaced(); sink.text( fieldName ); sink.monospaced_(); sink.tableCell_(); sink.tableRow_(); } } } plexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/report/Component.java0000644000175000017500000001234110700074416032463 0ustar twernertwernerpackage org.codehaus.plexus.maven.plugin.report; /* * Copyright 2007 The Codehaus Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.util.Iterator; import java.util.List; import org.codehaus.doxia.sink.Sink; import org.codehaus.plexus.util.StringUtils; import org.jdom.Element; /** * @author Trygve Laugstøl * @version $Id: Component.java 6925 2007-10-01 04:35:26Z user57 $ */ public class Component implements Comparable { private String description; private String role; private String roleHint; private String alias; private String version; private String implementation; private String instantiationStrategy; private Requirements requirements; private Configuration configuration; public Component( Element component ) { description = component.getChildText( "description" ); role = component.getChildText( "role" ); roleHint = component.getChildText( "role-hint" ); alias = component.getChildText( "alias" ); version = component.getChildText( "version" ); implementation = component.getChildText( "implementation" ); instantiationStrategy = component.getChildTextTrim( "instantiation-strategy" ); List list = component.getChildren( "requirements" ); for ( Iterator it = list.iterator(); it.hasNext(); ) { Element element = (Element) it.next(); requirements = new Requirements( element ); } list = component.getChildren( "configuration" ); for ( Iterator it = list.iterator(); it.hasNext(); ) { Element element = (Element) it.next(); configuration = new Configuration( element ); } } public String getRole() { return role; } public String getRoleHint() { return roleHint; } public String getImplementation() { return implementation; } public boolean hasRoleHint() { return StringUtils.isNotEmpty( roleHint ); } public void print( Sink sink, String javaDocDestDir, String jxrDestDir ) { // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- String title; if ( !hasRoleHint() ) { title = role; } else { title = roleHint; } // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- sink.section3(); sink.sectionTitle3(); sink.text( "Component: " + title ); sink.sectionTitle3_(); sink.section3_(); sink.table(); writeField( sink, "Role", role ); writeField( sink, "Role hint", roleHint ); sink.tableRow(); sink.tableCell(); sink.text( "Implementation" ); sink.tableCell_(); sink.tableCell(); sink.monospaced(); sink.text( implementation ); sink.monospaced_(); sink.text( " " ); sink.link( "../" + javaDocDestDir + "/" + implementation.replace( '.', '/' ) + ".html" ); sink.text( "javadoc" ); sink.link_(); sink.link( "../" + jxrDestDir + "/" + implementation.replace( '.', '/' ) + ".html" ); sink.text( " " ); sink.text( "xref" ); sink.link_(); sink.tableCell_(); sink.tableRow_(); writeField( sink, "Description", description ); writeField( sink, "Alias", alias ); writeField( sink, "Version", version ); writeField( sink, "Instantiation strategy", instantiationStrategy ); sink.table_(); if ( requirements != null ) { requirements.print( sink ); } if ( configuration != null ) { configuration.print( sink ); } } private void writeField( Sink sink, String name, String value ) { if ( StringUtils.isNotEmpty( value ) ) { sink.tableRow(); sink.tableCell(); sink.text( name ); sink.tableCell_(); sink.tableCell(); sink.monospaced(); sink.text( value ); sink.monospaced_(); sink.tableCell_(); sink.tableRow_(); } } public int compareTo( Object o ) { return ( (Component) o ).getId().compareTo( getId() ); } private String getId() { if ( !hasRoleHint() ) { return role; } else { return role + ":" + roleHint; } } } plexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/report/Components.java0000644000175000017500000001130710700074416032647 0ustar twernertwernerpackage org.codehaus.plexus.maven.plugin.report; /* * Copyright 2007 The Codehaus Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.SortedMap; import java.util.SortedSet; import java.util.TreeMap; import java.util.TreeSet; import org.codehaus.doxia.sink.Sink; import org.jdom.Element; /** * @author Trygve Laugstøl * @version $Id: Components.java 6925 2007-10-01 04:35:26Z user57 $ */ public class Components { private List components = new ArrayList(); public Components( Element element ) { for ( Iterator it = element.getChildren( "component" ).iterator(); it.hasNext(); ) { Element component = (Element) it.next(); components.add( new Component( component ) ); } } public void print( Sink sink, String javaDocDestDir, String jxrDestDir ) { SortedSet roles = new TreeSet(); SortedSet emptyList = new TreeSet(); SortedMap roleMap = new TreeMap(); // ---------------------------------------------------------------------- // Build stuff // ---------------------------------------------------------------------- for ( Iterator it = components.iterator(); it.hasNext(); ) { Component component = (Component) it.next(); roles.add( component.getRole() ); if ( !component.hasRoleHint() ) { emptyList.add( component ); } else { List list = (List) roleMap.get( component.getRole() ); if ( list == null ) { list = new ArrayList(); roleMap.put( component.getRole(), list ); } list.add( component ); } } // ---------------------------------------------------------------------- // Component role index // ---------------------------------------------------------------------- sink.section2(); sink.sectionTitle2(); sink.text( "Index" ); sink.sectionTitle2_(); sink.section2_(); sink.paragraph(); for ( Iterator it = roles.iterator(); it.hasNext(); ) { String role = (String) it.next(); sink.link( "#" + role ); sink.text( role ); sink.link_(); sink.lineBreak(); } sink.paragraph_(); // ---------------------------------------------------------------------- // Components without role hints // ---------------------------------------------------------------------- sink.section2(); sink.sectionTitle2(); sink.text( "Components without role-hint" ); sink.sectionTitle2_(); sink.section2_(); for ( Iterator it = emptyList.iterator(); it.hasNext(); ) { Component component = (Component) it.next(); sink.anchor( component.getRole() ); sink.paragraph(); component.print( sink, javaDocDestDir, jxrDestDir ); sink.paragraph_(); sink.anchor_(); } // ---------------------------------------------------------------------- // Components with role hint, sorted by role // ---------------------------------------------------------------------- for ( Iterator it = roleMap.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Map.Entry) it.next(); sink.section2(); sink.sectionTitle2(); sink.anchor( (String) entry.getKey() ); sink.text( "Components implementing " + entry.getKey() ); sink.anchor_(); sink.sectionTitle2_(); sink.section2_(); for ( Iterator j = ( (List) entry.getValue() ).iterator(); j.hasNext(); ) { Component component = (Component) j.next(); sink.paragraph(); component.print( sink, javaDocDestDir, jxrDestDir ); sink.paragraph_(); } } } } plexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/report/Configuration.java0000644000175000017500000000334210700074416033331 0ustar twernertwerner/* * The MIT License * * Copyright (c) 2006, The Codehaus * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.codehaus.plexus.maven.plugin.report; import org.codehaus.doxia.sink.Sink; import org.jdom.Element; /** * @author Trygve Laugstøl * @version $Id: Configuration.java 6925 2007-10-01 04:35:26Z user57 $ */ public class Configuration { public Configuration( Element element ) { } public void print( Sink sink ) { sink.section4(); sink.sectionTitle4(); sink.text( "Configuration" ); sink.lineBreak(); sink.sectionTitle4_(); sink.section4_(); sink.paragraph(); sink.paragraph_(); } } plexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/report/ComponentSet.java0000644000175000017500000000265510565423462033156 0ustar twernertwernerpackage org.codehaus.plexus.maven.plugin.report; /* * Copyright 2007 The Codehaus Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.util.List; import org.codehaus.doxia.sink.Sink; import org.jdom.Element; /** * @author Trygve Laugstøl * @version $Id: ComponentSet.java 5741 2007-02-16 21:50:42Z olamy $ */ public class ComponentSet { private Components components; public ComponentSet( Element element ) { List list = element.getChildren( "components" ); if ( list.size() > 1 ) { throw new RuntimeException( "The component set can only contain a single section." ); } components = new Components( (Element) list.get( 0 ) ); } public void print( Sink sink, String javaDocDestDir, String jxrDestDir ) { components.print( sink, javaDocDestDir, jxrDestDir ); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/PlexusTestDescriptorMojo.javaplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/PlexusTestDescriptorMojo.ja0000644000175000017500000000611610700074416033666 0ustar twernertwernerpackage org.codehaus.plexus.maven.plugin; /* * Copyright (c) 2004-2005, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import java.io.File; import java.util.Collections; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.artifact.handler.ArtifactHandler; /** * Generates a Plexus components.xml component descriptor file from test source (javadoc) or test class annotations. * * @goal test-descriptor * @phase process-test-classes * @requiresDependencyResolution test * * @author Trygve Laugstøl * @version $Id: PlexusTestDescriptorMojo.java 6925 2007-10-01 04:35:26Z user57 $ * @since 1.3.4 */ public class PlexusTestDescriptorMojo extends AbstractDescriptorMojo { // // FIXME: When running as process-classes, which is required to deal with the class-based annotation gleaning // we can't put the generated file into resources, as it will never make it to the correct directory // // expression="${project.build.directory}/generated-test-resources/plexus/" // /** * The output directory where the descriptor is written. * * @parameter expression="${project.build.testOutputDirectory}" * @required */ private File outputDirectory; public void execute() throws MojoExecutionException { // Only execute if the current project looks like its got Java bits in it ArtifactHandler artifactHandler = getMavenProject().getArtifact().getArtifactHandler(); if (!"java".equals(artifactHandler.getLanguage())) { log.debug("Not executing on non-Java project"); } else { generateDescriptor(TEST_SCOPE, new File(outputDirectory, fileName)); getMavenProjectHelper().addTestResource( getMavenProject(), outputDirectory.getAbsolutePath(), Collections.EMPTY_LIST, Collections.EMPTY_LIST ); } } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/PlexusComponentsReport.javaplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/PlexusComponentsReport.java0000644000175000017500000001202110700074416033723 0ustar twernertwernerpackage org.codehaus.plexus.maven.plugin; /* * The MIT License * * Copyright (c) 2006, The Codehaus * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import java.io.File; import java.io.IOException; import java.util.Locale; import org.apache.maven.project.MavenProject; import org.apache.maven.reporting.AbstractMavenReport; import org.apache.maven.reporting.MavenReportException; import org.codehaus.doxia.sink.Sink; import org.codehaus.doxia.site.renderer.SiteRenderer; import org.codehaus.plexus.maven.plugin.report.ComponentSet; import org.jdom.Document; import org.jdom.JDOMException; import org.jdom.input.SAXBuilder; /** * @goal components-report * * @execute phase="process-resources" lifecycle="plexus-site" * * @author Trygve Laugstøl * @version $Id: PlexusComponentsReport.java 6925 2007-10-01 04:35:26Z user57 $ */ public class PlexusComponentsReport extends AbstractMavenReport { /** * @parameter default-value="${project.build.outputDirectory}/META-INF/plexus/components.xml" * @required */ private File componentsXml; /** * @parameter expression="${project}" * @readonly */ private MavenProject project; /** * @component org.codehaus.doxia.site.renderer.SiteRenderer */ private SiteRenderer siteRenderer; /** * @parameter expression="${project.reporting.outputDirectory} */ private String outputDirectory; /** * Location of javadoc report * * @parameter expression="${javaDocDestDir}" default-value="apidocs" */ private String javaDocDestDir; /** * Location of xref report * * @parameter expression="${jxrDestDir}" default-value="xref" */ private String jxrDestDir; // ---------------------------------------------------------------------- // MavenReport Implementation // ---------------------------------------------------------------------- public String getOutputName() { return "plexus/plexus-components"; } public String getName( Locale locale ) { return "Plexus Components"; } public String getCategoryName() { return CATEGORY_PROJECT_REPORTS; } public String getDescription( Locale locale ) { return "Plexus components report description"; } protected MavenProject getProject() { return project; } protected SiteRenderer getSiteRenderer() { return siteRenderer; } protected String getOutputDirectory() { return outputDirectory; } public boolean canGenerateReport() { return componentsXml.isFile(); } protected void executeReport( Locale locale ) throws MavenReportException { String title = "Plexus Components Report"; Sink sink = getSink(); sink.head(); sink.title(); sink.text( title ); sink.title_(); sink.head_(); sink.body(); sink.section1(); sink.sectionTitle1(); sink.text( title ); sink.sectionTitle1_(); Document document; try { document = new SAXBuilder().build( componentsXml ); } catch ( JDOMException e ) { throw new MavenReportException( "Error while building document of " + componentsXml.getAbsolutePath() + ".", e ); } catch ( IOException e ) { throw new MavenReportException( "Error while building document of " + componentsXml.getAbsolutePath() + ".", e ); } if ( document.getRootElement().getName().equals( "component-set" ) ) { ComponentSet componentSet = new ComponentSet( document.getRootElement() ); componentSet.print( sink, javaDocDestDir, jxrDestDir ); } sink.body_(); sink.flush(); } } plexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/PlexusDescriptorMojo.java0000644000175000017500000000462110701413305033347 0ustar twernertwernerpackage org.codehaus.plexus.maven.plugin; /* * Copyright (c) 2004-2005, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import java.io.File; import java.util.Collections; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.artifact.handler.ArtifactHandler; /** * Generates a Plexus components.xml component descriptor file from source (javadoc) or class annotations. * * @goal descriptor * @phase process-classes * @requiresDependencyResolution compile * * @author Trygve Laugstøl * @version $Id: PlexusDescriptorMojo.java 6933 2007-10-05 10:49:41Z user57 $ */ public class PlexusDescriptorMojo extends AbstractDescriptorMojo { /** * The directory where the descriptor is written. * * @parameter expression="${project.build.outputDirectory}" * @required */ private File outputDirectory; public void execute() throws MojoExecutionException { // Only execute if the current project looks like its got Java bits in it ArtifactHandler artifactHandler = getMavenProject().getArtifact().getArtifactHandler(); if (!"java".equals(artifactHandler.getLanguage())) { log.debug("Not executing on non-Java project"); } else { generateDescriptor(COMPILE_SCOPE, new File(outputDirectory, fileName)); } } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/ClassComponentDescriptorExtractor.javaplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/ClassComponentDescriptorExt0000644000175000017500000001264110701413253033736 0ustar twernertwerner/* * Copyright (C) 2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.codehaus.plexus.maven.plugin; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.cdc.gleaner.ClassComponentGleaner; import org.codehaus.plexus.component.repository.cdc.ComponentDescriptor; import org.codehaus.plexus.util.DirectoryScanner; /** * Extracts {@link ComponentDescriptor} from class files. * * @version $Id: ClassComponentDescriptorExtractor.java 6932 2007-10-05 10:49:15Z user57 $ */ public class ClassComponentDescriptorExtractor extends ComponentDescriptorExtractorSupport { private ClassComponentGleaner gleaner; public ClassComponentDescriptorExtractor(final ClassComponentGleaner gleaner) { this.gleaner = gleaner; } public ClassComponentDescriptorExtractor() {} public List extract(final MavenProject project, final String scope, final ComponentDescriptor[] roleDefaults) throws Exception { assert project != null; assert scope != null; assert roleDefaults != null; // We don't have a reasonable default to use, so just puke up if (gleaner == null) { throw new IllegalStateException("Gleaner is not bound"); } log.debug("Gleaner: " + gleaner + ", scope: " + scope); List classpath; File classesDir; if (COMPILE_SCOPE.equals(scope)) { classpath = project.getCompileClasspathElements(); classesDir = new File(project.getBuild().getOutputDirectory()); } else if (TEST_SCOPE.equals(scope)) { classpath = project.getTestClasspathElements(); classesDir = new File(project.getBuild().getTestOutputDirectory()); } else { throw new IllegalArgumentException("Invalid scope: " + scope); } if (!classesDir.exists()) { log.warn("Missing classes directory: {}", classesDir); return Collections.EMPTY_LIST; } final ClassLoader prev = Thread.currentThread().getContextClassLoader(); final ClassLoader cl = createClassLoader(classpath); Thread.currentThread().setContextClassLoader(cl); try { return extract(classesDir, cl, getDefaultsByRole(roleDefaults)); } finally { Thread.currentThread().setContextClassLoader(prev); } } private ClassLoader createClassLoader(final List elements) throws Exception { List list = new ArrayList(); // Add the projects dependencies for (Iterator iter = elements.iterator(); iter.hasNext();) { String filename = (String) iter.next(); try { list.add(new File(filename).toURI().toURL()); } catch (MalformedURLException e) { throw new MojoExecutionException("Invalid classpath entry: " + filename, e); } } URL[] urls = (URL[]) list.toArray(new URL[list.size()]); log.debug("Classpath:"); for (int i=0; iTrygve Laugstøl * @version $Id: PlexusTestMergeMojo.java 6925 2007-10-01 04:35:26Z user57 $ */ public class PlexusTestMergeMojo extends AbstractMergeMojo { /** * @parameter expression="${project.testResources}" * @required */ private List resources; /** * @parameter expression="${project.build.testOutputDirectory}/META-INF/plexus/components.xml" * @required */ private File output; protected List getResources() { return resources; } protected File getOutput() { return output; } } plexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/PlexusMergeMojo.java0000644000175000017500000000367310565423462032313 0ustar twernertwernerpackage org.codehaus.plexus.maven.plugin; /* * Copyright (c) 2004-2006, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import java.io.File; import java.util.List; /** * @goal merge-descriptors * * @phase process-resources * * @description Merges all Plexus descriptors in the main sources. * * @author Trygve Laugstøl * @version $Id: PlexusMergeMojo.java 5741 2007-02-16 21:50:42Z olamy $ */ public class PlexusMergeMojo extends AbstractMergeMojo { /** * @parameter expression="${project.resources}" * @required */ private List resources; /** * @parameter expression="${project.build.outputDirectory}/META-INF/plexus/components.xml" * @required */ private File output; protected List getResources() { return resources; } protected File getOutput() { return output; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/ComponentDescriptorExtractor.javaplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/ComponentDescriptorExtracto0000644000175000017500000000251610700074416034004 0ustar twernertwerner/* * Copyright (C) 2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.codehaus.plexus.maven.plugin; import java.util.List; import org.apache.maven.project.MavenProject; import org.apache.maven.plugin.logging.Log; import org.codehaus.plexus.component.repository.cdc.ComponentDescriptor; /** * An abstraction to allow pluggable {@link ComponentDescriptor} extraction to be dropped. * * @version $Id: ComponentDescriptorExtractor.java 6925 2007-10-01 04:35:26Z user57 $ */ public interface ComponentDescriptorExtractor { String ROLE = ComponentDescriptorExtractor.class.getName(); String COMPILE_SCOPE = "compile"; String TEST_SCOPE = "test"; List/**/ extract(MavenProject project, String scope, ComponentDescriptor[] roleDefaults) throws Exception; } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/AbstractDescriptorMojo.javaplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/AbstractDescriptorMojo.java0000644000175000017500000001306410700074416033640 0ustar twernertwernerpackage org.codehaus.plexus.maven.plugin; /* * The MIT License * * Copyright (c) 2004-2006, The Codehaus * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProjectHelper; import org.codehaus.plexus.cdc.ComponentDescriptorWriter; import org.codehaus.plexus.component.repository.cdc.ComponentDescriptor; import org.codehaus.plexus.component.repository.cdc.ComponentSetDescriptor; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Rahul Thakur * @since 1.3.4 */ public abstract class AbstractDescriptorMojo extends AbstractMojo { protected static final String COMPILE_SCOPE = "compile"; protected static final String TEST_SCOPE = "test"; protected final Logger log = LoggerFactory.getLogger(getClass()); /** * @parameter expression="META-INF/plexus/components.xml" * @required */ protected String fileName; /** * Whether to generate a Plexus Container descriptor instead of a component descriptor. * * @parameter default-value="false" * @required */ private boolean containerDescriptor; /** * @parameter expression="${project}" * @required */ private MavenProject mavenProject; /** * @parameter */ private ComponentDescriptor[] roleDefaults; /** * @parameter */ private ComponentDescriptorExtractor[] extractors; /** * @component */ private ComponentDescriptorWriter writer; /** * @component */ private MavenProjectHelper mavenProjectHelper; protected MavenProject getMavenProject() { return mavenProject; } protected MavenProjectHelper getMavenProjectHelper() { return mavenProjectHelper; } // ----------------------------------------------------------------------- // // ----------------------------------------------------------------------- protected void generateDescriptor(final String scope, final File outputFile) throws MojoExecutionException { assert scope != null; assert outputFile != null; // If no extractors are configured then use a default (javadoc-style source extraction) if (extractors == null || extractors.length == 0) { extractors = new ComponentDescriptorExtractor[] { new SourceComponentDescriptorExtractor(), }; } List descriptors = new ArrayList(); for (int i=0; iTrygve Laugstøl * @version $Id: AbstractMergeMojo.java 6925 2007-10-01 04:35:26Z user57 $ */ public abstract class AbstractMergeMojo extends AbstractMojo { // ----------------------------------------------------------------------- // Abstract Methods // ----------------------------------------------------------------------- protected abstract List getResources(); protected abstract File getOutput(); // ---------------------------------------------------------------------- // Parameters // ---------------------------------------------------------------------- /** * @parameter */ private File[] descriptors; // ---------------------------------------------------------------------- // Components // ---------------------------------------------------------------------- /** * @component */ private ComponentDescriptorCreator cdc; // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- public void execute() throws MojoExecutionException { // ---------------------------------------------------------------------- // Locate files // ---------------------------------------------------------------------- List files = new ArrayList(); for ( Iterator it = getResources().iterator(); it.hasNext(); ) { Resource resource = (Resource) it.next(); String includes = "META-INF/plexus/components.xml"; String excludes = ""; for ( Iterator j = resource.getExcludes().iterator(); j.hasNext(); ) { String exclude = (String) j.next(); excludes += exclude + ","; } try { File basedir = new File( resource.getDirectory() ); getLog().debug( "Searching for component.xml files. Basedir: " + basedir.getAbsolutePath() + ", includes: " + includes + ", excludes=" + excludes ); if ( !basedir.isDirectory() ) { getLog().debug( "Skipping, not a directory." ); continue; } List list = FileUtils.getFiles( basedir, includes, excludes ); files.addAll( list ); } catch ( IOException e ) { throw new MojoExecutionException( "Error while scanning for component.xml files.", e ); } } if ( descriptors != null ) { files.addAll( Arrays.asList( descriptors ) ); } // ---------------------------------------------------------------------- // Merge the component set descriptors // ---------------------------------------------------------------------- if ( files.isEmpty() ) { getLog().debug( "Didn't find any files to merge." ); return; } getLog().debug( "Found " + files.size() + " files to merge:" ); for ( Iterator it = files.iterator(); it.hasNext(); ) { File file = (File) it.next(); getLog().debug( file.getAbsolutePath() ); } try { cdc.mergeDescriptors( getOutput(), files ); } catch ( ComponentDescriptorCreatorException e ) { throw new MojoExecutionException( "Error while executing component descritor creator.", e ); } } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/PlexusCheckRoleHintsMojo.javaplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/PlexusCheckRoleHintsMojo.ja0000644000175000017500000001454410700074416033561 0ustar twernertwernerpackage org.codehaus.plexus.maven.plugin; /* * Copyright (c) 2004-2005, Codehaus.org * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import java.io.File; import java.io.IOException; import java.util.Iterator; import java.util.List; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.jdom.Document; import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.input.SAXBuilder; /** * PlexusCheckRoleHintsMojo * * @author Joakim Erdfelt * @version $Id: PlexusCheckRoleHintsMojo.java 6925 2007-10-01 04:35:26Z user57 $ * * @goal check-role-hints * * @phase test */ public class PlexusCheckRoleHintsMojo extends AbstractMojo { /** * The META-INF/plexus/ directory that contains the post-processed * plexus data files. [ components.xml, application.xml, and plexus.xml ] * * @parameter expression="${project.build.outputDirectory}/META-INF/plexus" * @required */ private File plexusDirectory; public void execute() throws MojoExecutionException, MojoFailureException { File componentsXml = new File( plexusDirectory, "components.xml" ); if ( componentsXml.exists() ) { checkPlexusRoleHints( componentsXml ); } File applicationXml = new File( plexusDirectory, "application.xml" ); if ( applicationXml.exists() ) { checkPlexusRoleHints( applicationXml ); } File plexusXml = new File( plexusDirectory, "plexus.xml" ); if ( plexusXml.exists() ) { checkPlexusRoleHints( plexusXml ); } } /** * Load document via jdom, perform some basic checks. * * @param componentsXml * @throws MojoFailureException */ private void checkPlexusRoleHints( File componentsXml ) throws MojoExecutionException, MojoFailureException { int violationCount = 0; SAXBuilder builder = new SAXBuilder(); try { Document doc = builder.build( componentsXml ); Element root = doc.getRootElement(); if ( !root.getName().equals( "component-set" ) ) { getLog().warn( "Not a plexus components.xml - doesn't start with " ); return; } List componentsList = root.getChildren( "components" ); for ( Iterator itcomponents = componentsList.iterator(); itcomponents.hasNext(); ) { Element components = (Element) itcomponents.next(); violationCount += countComponentRoleHintViolations( components ); } if ( violationCount > 0 ) { throw new MojoFailureException( componentsXml.getAbsolutePath() + " has " + violationCount + " role-hint violation(s)." ); } } catch ( JDOMException e ) { throw new MojoExecutionException( "Unable to load " + componentsXml.getAbsolutePath() + ", it is not valid.", e ); } catch ( IOException e ) { throw new MojoExecutionException( "Unable to load " + componentsXml.getAbsolutePath() + ": " + e.getMessage(), e ); } } private int countComponentRoleHintViolations( Element components ) { int violationCount = 0; List componentList = components.getChildren( "component" ); for ( Iterator itcomponent = componentList.iterator(); itcomponent.hasNext(); ) { Element component = (Element) itcomponent.next(); String componentRole = component.getChildText( "role" ); // Test component definition. Element componentRoleHint = component.getChild( "role-hint" ); if ( componentRoleHint == null ) { violationCount++; getLog().error( "Missing on component definition for " + componentRole ); } // Test requirements. List requirementsList = component.getChildren( "requirements" ); for ( Iterator itrequirements = requirementsList.iterator(); itrequirements.hasNext(); ) { Element requirements = (Element) itrequirements.next(); violationCount += countRequirementRoleHintViolations( requirements ); } } return violationCount; } private int countRequirementRoleHintViolations( Element requirements ) { int violationCount = 0; List requirementList = requirements.getChildren( "requirement" ); for ( Iterator itrequirement = requirementList.iterator(); itrequirement.hasNext(); ) { Element requirement = (Element) itrequirement.next(); String requirementRole = requirement.getChildText( "role" ); // Test requirement definition. Element requirementRoleHint = requirement.getChild( "role-hint" ); if ( requirementRoleHint == null ) { violationCount++; getLog().error( "Missing on definition for " + requirementRole ); } } return violationCount; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/ComponentDescriptorExtractorSupport.javaplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/ComponentDescriptorExtracto0000644000175000017500000000437410700074416034010 0ustar twernertwerner/* * Copyright (C) 2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.codehaus.plexus.maven.plugin; import java.util.HashMap; import java.util.Map; import org.codehaus.plexus.component.repository.cdc.ComponentDescriptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Support for {@link ComponentDescriptorExtractor} implementations. * * @version $Id: ComponentDescriptorExtractorSupport.java 6925 2007-10-01 04:35:26Z user57 $ */ public abstract class ComponentDescriptorExtractorSupport implements ComponentDescriptorExtractor { protected final Logger log = LoggerFactory.getLogger(getClass()); protected Map getDefaultsByRole(final ComponentDescriptor[] roleDefaults) { Map defaultsByRole = new HashMap(); if (roleDefaults != null) { for (int i = 0; i < roleDefaults.length; i++) { String role = roleDefaults[i].getRole(); if (role == null) { throw new IllegalArgumentException("Invalid role defaults; found null role in: " + roleDefaults[i]); } defaultsByRole.put(role, roleDefaults[i]); } } return defaultsByRole; } protected void applyDefaults(final ComponentDescriptor descriptor, final Map defaultsByRole) { assert descriptor != null; assert defaultsByRole != null; if (defaultsByRole.containsKey(descriptor.getRole())) { ComponentDescriptor defaults = (ComponentDescriptor) defaultsByRole.get(descriptor.getRole()); if (descriptor.getInstantiationStrategy() == null) { descriptor.setInstantiationStrategy(defaults.getInstantiationStrategy()); } } } }././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/SourceComponentDescriptorExtractor.javaplexus-maven-plugin-1.3.8/src/main/java/org/codehaus/plexus/maven/plugin/SourceComponentDescriptorEx0000644000175000017500000000725710742445707033772 0ustar twernertwerner/* * Copyright (C) 2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.codehaus.plexus.maven.plugin; import java.io.File; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import com.thoughtworks.qdox.JavaDocBuilder; import com.thoughtworks.qdox.model.JavaClass; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.cdc.gleaner.QDoxComponentGleaner; import org.codehaus.plexus.cdc.gleaner.SourceComponentGleaner; import org.codehaus.plexus.component.repository.cdc.ComponentDescriptor; /** * Extracts {@link ComponentDescriptor} from source files. * * @version $Rev: 7163 $ $Date: 2008-01-13 18:35:03 +0100 (So, 13. Jan 2008) $ */ public class SourceComponentDescriptorExtractor extends ComponentDescriptorExtractorSupport { private SourceComponentGleaner gleaner; public SourceComponentDescriptorExtractor(final SourceComponentGleaner gleaner) { this.gleaner = gleaner; } public SourceComponentDescriptorExtractor() {} public List extract(final MavenProject project, final String scope, final ComponentDescriptor[] roleDefaults) throws Exception { assert project != null; assert scope != null; // getDefaultsByRole() seems to check for null and maven-artifact project works fine when // assertions are disabled. // assert roleDefaults != null; // Use a default source gleaner if none was configured if (gleaner == null) { gleaner = new QDoxComponentGleaner(); } log.debug("Gleaner: " + gleaner + ", scope: " + scope); List roots; if (COMPILE_SCOPE.equals(scope)) { roots = project.getCompileSourceRoots(); } else if (TEST_SCOPE.equals(scope)) { roots = project.getTestCompileSourceRoots(); } else { throw new IllegalArgumentException("Invalid scope: " + scope); } return extract(roots, getDefaultsByRole(roleDefaults)); } private List extract(final List sourceDirectories, final Map defaultsByRole) throws Exception { assert sourceDirectories != null; assert defaultsByRole != null; List descriptors = new ArrayList(); // Scan the sources JavaDocBuilder builder = new JavaDocBuilder(); for (Iterator iter = sourceDirectories.iterator(); iter.hasNext();) { File dir = new File((String)iter.next()); log.debug("Adding source directory: " + dir); builder.addSourceTree(dir); } JavaClass[] classes = builder.getClasses(); // For each class we find, try to glean off a descriptor for (int i = 0; i < classes.length; i++) { log.debug("Gleaning from: " + classes[i].getFullyQualifiedName()); ComponentDescriptor descriptor = gleaner.glean(builder, classes[i]); if (descriptor != null) { applyDefaults(descriptor, defaultsByRole); descriptors.add(descriptor); } } log.debug("Extracted " + descriptors.size() + " descriptor(s)"); return descriptors; } }plexus-maven-plugin-1.3.8/src/main/resources/0000755000175000017500000000000011121276713021127 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/main/resources/META-INF/0000755000175000017500000000000011121276713022267 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/main/resources/META-INF/plexus/0000755000175000017500000000000011121276713023607 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/main/resources/META-INF/plexus/components.xml0000644000175000017500000000274710700074416026526 0ustar twernertwerner org.apache.maven.reporting.MavenReport plexus-components org.codehaus.plexus.maven.plugin.PlexusComponentsReport org.codehaus.plexus.maven.plugin.ComponentDescriptorExtractor source org.codehaus.plexus.maven.plugin.SourceComponentDescriptorExtractor org.codehaus.plexus.cdc.gleaner.SourceComponentGleaner gleaner org.codehaus.plexus.maven.plugin.ComponentDescriptorExtractor class org.codehaus.plexus.maven.plugin.ClassComponentDescriptorExtractor org.codehaus.plexus.cdc.gleaner.ClassComponentGleaner gleaner plexus-maven-plugin-1.3.8/src/main/resources/META-INF/maven/0000755000175000017500000000000011121276713023375 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/main/resources/META-INF/maven/lifecycle.xml0000644000175000017500000000330010700074416026050 0ustar twernertwerner plexus-site generate-sources descriptor merge-descriptors plexus-maven-plugin-1.3.8/src/site/0000755000175000017500000000000011121276713017135 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/site/xdoc/0000755000175000017500000000000011121276713020072 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/site/xdoc/index.xml0000755000175000017500000000345410565605326021743 0ustar twernertwerner Plexus Maven Plugin How To Olivier Lamy

This plugin provide some help with Maven : goals

A mojo will generate a component descriptor file.


The component descriptor will contains all component defined with javadoc tags in your sources.


Add this plugin (Automatically executes within the lifecycle phase: process-sources) as this : org.codehaus.plexus plexus-maven-plugin descriptor ]]>

A reporting mojo will generated a report on available components (sample).


Add this plugin in your reporting section as this : org.codehaus.plexus plexus-maven-plugin ]]>

plexus-maven-plugin-1.3.8/src/site/site.xml0000755000175000017500000000135510565605326020641 0ustar twernertwerner Plexus http://plexus.codehaus.org/ /images/plexus-logo.png org.codehaus.plexus plexus-stylus-skin 1.0-SNAPSHOT plexus-maven-plugin-1.3.8/src/it/0000755000175000017500000000000011121276713016605 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/it/descriptor-1/0000755000175000017500000000000011121276713021121 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/it/descriptor-1/src/0000755000175000017500000000000011121276713021710 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/it/descriptor-1/src/main/0000755000175000017500000000000011121276713022634 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/it/descriptor-1/src/main/java/0000755000175000017500000000000011121276713023555 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/it/descriptor-1/src/main/java/testing/0000755000175000017500000000000011121276713025232 5ustar twernertwernerplexus-maven-plugin-1.3.8/src/it/descriptor-1/src/main/java/testing/ChildComponent.java0000644000175000017500000000145610700074416031007 0ustar twernertwerner/* * Copyright (C) 2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package testing; /** * ??? * * @plexus.component role="testing.ChildComponent" * * @version $Id: ChildComponent.java 6925 2007-10-01 04:35:26Z user57 $ */ public class ChildComponent { } plexus-maven-plugin-1.3.8/src/it/descriptor-1/src/main/java/testing/MyComponent.java0000644000175000017500000000210210700074416030336 0ustar twernertwerner/* * Copyright (C) 2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package testing; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.component.annotations.Configuration; /** * ??? * * @version $Id: MyComponent.java 6925 2007-10-01 04:35:26Z user57 $ */ @Component(role=MyComponent.class, hint="foo") public class MyComponent { @Requirement private ChildComponent child; @Configuration("bar") private String foo; } plexus-maven-plugin-1.3.8/src/it/descriptor-1/pom.xml0000644000175000017500000000317210700074416022437 0ustar twernertwerner 4.0.0 org.codehaus.plexus.it.plexus-maven-plugin descriptor-1 testing org.codehaus.plexus plexus-maven-plugin testing descriptor plexus-maven-plugin-1.3.8/src/it/descriptor-1/goals.txt0000644000175000017500000000001610700074416022762 0ustar twernertwernerclean package plexus-maven-plugin-1.3.8/src/it/descriptor-1/validate.groovy0000644000175000017500000000157410700074416024166 0ustar twernertwerner/* * Copyright (C) 2006-2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // $Id: validate.groovy 6925 2007-10-01 04:35:26Z user57 $ // def file = new File(basedir, 'target/classes/META-INF/plexus/components.xml') assert file.exists() def componentSet = new XmlParser().parse(file) assert componentSet.components.component.size() == 2 plexus-maven-plugin-1.3.8/pom.xml0000644000175000017500000001026310744177614016733 0ustar twernertwerner plexus org.codehaus.plexus 1.0.10 4.0.0 plexus-maven-plugin maven-plugin Plexus Maven Plugin 1.3.8 snapshots.apache.org http://people.apache.org/repo/m2-snapshot-repository false true org.slf4j slf4j-api 1.4.3 org.slf4j slf4j-simple 1.4.3 org.apache.maven maven-plugin-api 2.0.5 org.apache.maven maven-model 2.0.5 org.apache.maven.reporting maven-reporting-api 2.0 org.apache.maven.reporting maven-reporting-impl 2.0 org.codehaus.plexus plexus-cdc 1.0-alpha-13 scm:svn:http://svn.codehaus.org/plexus/plexus-maven-plugin/tags/plexus-maven-plugin-1.3.8 scm:svn:https://svn.codehaus.org/plexus/plexus-maven-plugin/tags/plexus-maven-plugin-1.3.8 http://fisheye.codehaus.org/browse/plexus/plexus-maven-plugin/tags/plexus-maven-plugin-1.3.8 maven-javadoc-plugin maven-jxr-plugin maven-plugin-plugin super-helpful-integration-tests shit true install org.codehaus.mojo shitty-maven-plugin 1.0-alpha-1-SNAPSHOT clean install test