MAVEN进行debug过程

  1. pom.xml配置


  2. <build>
        <finalName>vst_order</finalName>
        <resources>
                <resource>
                    <directory>src/main/config</directory>
                    <excludes>
                        <exclude>*.properties</exclude>
                    </excludes>
                </resource>
                
                <resource>
                    <directory>src/main/java</directory>
                    <includes>
                        <include>**/*.xml</include>
                    </includes>
                    <filtering>false</filtering>  
                </resource>
                
            </resources>
             <testResources>
                <testResource>
                    <directory>src/test/config</directory>
                </testResource>
                <testResource>
                    <directory>src/test/java</directory>
                </testResource>
            </testResources>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                        <source>1.6</source>
                        <target>1.6</target>
                    </configuration>
                </plugin>
                <plugin>
    			   <groupId>org.apache.maven.plugins</groupId>   
    			   <artifactId>maven-war-plugin</artifactId>   
    			   <version>2.2</version>   
    			   <configuration>
    					<archiveClasses>true</archiveClasses>
    				</configuration>   
    			 </plugin>
    			 <!-- 
    			 
    			  -->
    			 <plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-surefire-plugin</artifactId>
    				<configuration>
    					<skip>true</skip>
    				</configuration>
    			</plugin>
            </plugins>
      </build>
  3. java目录结构

    test目录下配置config目录和java目录,将所有相关配置文件放到config目录中

  4. java代码书写

  5. private LineProdPackageGroupService lineProdPackageGroupServiceImpl;
    
    	@Before
    	public void prepare() {
    		String[] contextPaths = {"applicationContext-vst-order-beans.xml"};
    		applicationContext = new ClassPathXmlApplicationContext(contextPaths);
    		if (this.applicationContext != null) {
    			this.lineProdPackageGroupServiceImpl = (LineProdPackageGroupService) this.applicationContext
    					.getBean("lineProdPackageGroupServiceImpl");
    		}
    	}
    	@Test
    	public void testCreateProduct(){
    	this.lineProdPackageGroupServiceImpl.initTrafficBizInfo(null);}

你可能感兴趣的:(MAVEN进行debug过程)