View Javadoc

1   package org.codehaus.mojo.javascript;
2   
3   /*
4    * Derivative Work
5    * Copyright 2010 SOFTEC sa. All rights reserved.
6    *
7    * Original Work
8    * Copyright 2001-2005 The Apache Software Foundation.
9    *
10   * Licensed under the Apache License, Version 2.0 (the "License");
11   * you may not use this file except in compliance with the License.
12   * You may obtain a copy of the License at
13   *
14   *      http://www.apache.org/licenses/LICENSE-2.0
15   *
16   * Unless required by applicable law or agreed to in writing, software
17   * distributed under the License is distributed on an "AS IS" BASIS,
18   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19   * See the License for the specific language governing permissions and
20   * limitations under the License.
21   */
22  
23  import java.io.File;
24  
25  /**
26   * Goal used to package compressed JavaScript files and package them as a javascript archive
27   * attaching this new artifact to the project for beeing installed / deployed with
28   * the regular uncompressed js-archive.
29   * 
30   * @goal attach-compressed
31   * @phase package
32   */
33  public class AttachCompressedMojo
34      extends AbstractPackageMojo
35  {
36      /**
37       * The output directory of the compressed javascript files.
38       * 
39       * @parameter default-value="${project.build.directory}/compressed"
40       */
41      private File compressedDirectory;
42  
43      /**
44       * The output directory of the compressed javascript archive.
45       * 
46       * @parameter default-value="${project.build.directory}"
47       */
48      private File buildDirectory;
49  
50      /**
51       * classifier for the compressed artifact
52       * 
53       * @parameter default-value="compressed"
54       */
55      private String classifier;
56  
57      /**
58       * {@inheritDoc}
59       * 
60       * @see org.codehaus.mojo.javascript.AbstractPackageMojo#getOutputDirectory()
61       */
62      protected File getOutputDirectory()
63      {
64          return buildDirectory;
65      }
66  
67      String getClassifier()
68      {
69          return classifier;
70      }
71  
72      /**
73       * {@inheritDoc}
74       *
75       * @see org.codehaus.mojo.javascript.AbstractPackageMojo#getScriptsDirectory()
76       */
77      protected File getScriptsDirectory()
78      {
79          return compressedDirectory;
80      }
81  }