View Javadoc
1   /**
2    * Copyright 2004-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.common.maven.spring;
17  
18  import java.util.List;
19  
20  import org.apache.maven.project.MavenProject;
21  import org.kuali.common.util.execute.Executable;
22  import org.kuali.common.util.execute.ShowPropertiesExecutable;
23  import org.kuali.common.util.maven.MavenConstants;
24  import org.kuali.common.util.spring.SpringUtils;
25  import org.springframework.beans.factory.annotation.Autowired;
26  import org.springframework.beans.factory.annotation.Qualifier;
27  import org.springframework.context.annotation.Bean;
28  import org.springframework.context.annotation.Configuration;
29  import org.springframework.core.env.Environment;
30  
31  @Configuration
32  public class ShowNativeMavenPropertiesConfig {
33  
34  	@Autowired
35  	Environment env;
36  
37  	@Autowired
38  	@Qualifier(MavenConstants.PROJECT_BEAN_NAME)
39  	MavenProject mavenProject;
40  
41  	@Bean(initMethod = "execute")
42  	public Executable showNativeMavenPropertiesExecutable() {
43  		List<String> includes = SpringUtils.getListFromCSV(env, "properties.show.includes", "*");
44  		List<String> excludes = SpringUtils.getListFromCSV(env, "properties.show.excludes", "");
45  
46  		ShowPropertiesExecutable executable = new ShowPropertiesExecutable();
47  		executable.setProperties(mavenProject.getProperties());
48  		executable.setExcludes(excludes);
49  		executable.setIncludes(includes);
50  		return executable;
51  	}
52  
53  }