EMMA Coverage Report (generated Thu Mar 10 11:16:09 GMT 2011)
[all classes][npanday.plugin.aspx]

COVERAGE SUMMARY FOR SOURCE FILE [AspxBinDependencyResolver.java]

nameclass, %method, %block, %line, %
AspxBinDependencyResolver.java100% (1/1)100% (4/4)87%  (95/109)89%  (17/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AspxBinDependencyResolver100% (1/1)100% (4/4)87%  (95/109)89%  (17/19)
execute (): void 100% (1/1)86%  (84/98)86%  (12/14)
AspxBinDependencyResolver (): void 100% (1/1)100% (3/3)100% (1/1)
setBinDir (File): void 100% (1/1)100% (4/4)100% (2/2)
setDependencies (Set): void 100% (1/1)100% (4/4)100% (2/2)

1package npanday.plugin.aspx;
2 
3/*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements.  See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership.  The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License.  You may obtain a copy of the License at
11 *
12 *   http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied.  See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21 
22import java.lang.StackTraceElement; 
23import java.io.File;
24import java.io.IOException;
25import java.util.Set;
26import java.util.ArrayList;
27 
28import org.apache.maven.artifact.Artifact;
29import org.apache.maven.plugin.AbstractMojo;
30import org.apache.maven.plugin.MojoExecutionException;
31import org.apache.maven.plugin.MojoFailureException;
32import org.apache.maven.project.MavenProject;
33import org.codehaus.plexus.util.FileUtils;
34import npanday.PathUtil;
35 
36 
37/**
38 * Maven Mojo for copying ASPx project dependencies to sourceDirectory\Bin folder
39 *
40 * @goal copy-dependency
41 * @phase process-sources
42 * @description Maven Mojo for copying ASPx project dependencies to sourceDirectory\Bin folder
43 */
44public class AspxBinDependencyResolver
45        extends AbstractMojo {
46    /**
47     * The dependencies.
48     *
49     * @parameter expression="${project.dependencyArtifacts}"
50     * @required
51     */
52    private Set<Artifact> dependencies;
53 
54    /**
55     * The bin directory.
56     *
57     * @parameter default-value="${project.build.sourceDirectory}/Bin"
58     * @required
59     */
60    private File binDir;
61 
62    public void execute()
63            throws MojoExecutionException, MojoFailureException {
64        for (Artifact dependency : dependencies) {
65            try {
66                String filename = dependency.getArtifactId() + "." + dependency.getArtifactHandler().getExtension();
67                File targetFile = new File(binDir, filename);
68 
69                if (!targetFile.exists()) {
70                    getLog().debug("NPANDAY-000-0001: copy dependency: typeof:" +  dependency.getClass());
71                    getLog().debug("NPANDAY-000-0001: copy dependency: " + dependency);
72                    getLog().debug("NPANDAY-000-0002: copying " + dependency.getFile().getAbsolutePath() + " to " + targetFile);
73                    File sourceFile = PathUtil.getGACFile4Artifact(dependency);
74 
75                    FileUtils.copyFile(sourceFile, targetFile);
76                    
77                }
78            }
79            catch (IOException ioe) {
80                throw new MojoExecutionException("NPANDAY-000-00002: Error copying dependency " + dependency, ioe);
81                
82            }
83        }
84    }
85 
86    public void setBinDir(File binDir) {
87        this.binDir = binDir;
88    }
89 
90    public void setDependencies(Set<Artifact> dependencies) {
91        this.dependencies = dependencies;
92    }
93}

[all classes][npanday.plugin.aspx]
EMMA 2.0.5312 (C) Vladimir Roubtsov