java - Maven configuration not work -
this question has answer here:
i want able use different log4j configuration different environments. if run project in tomcat (localhost:8080
) need use dev.properties
, if run project in product server need use prod.properties
. found described here copied code best answer, pom.xml display error:
<build> <finalname>secure-exam</finalname> <plugins> <plugin> <artifactid>maven-compiler-plugin</artifactid> <configuration> <source>1.7</source> <target>1.7</target> </configuration> <executions> <execution> <id>log4j</id> <phase>process-resources</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputdirectory>output_directory</outputdirectory> <resources> <resource>${log4j.file}</resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> </build> <profiles> <profile> <id>dev</id> <activation> <activebydefault>true</activebydefault> </activation> <properties> <log4j.file>/home/name/workspace/spring/src/main/resources/console_log4j.properties</log4j.file> </properties> </profile> <profile> <id>prod</id> <properties> <log4j.file>/home/name/workspace/spring/src/main/resources/fiile_log4j.properties</log4j.file> </properties> </profile> </profiles>
this error show in pom.xml
file
show cannot resolve sympol `copy-resources` element outputdirectory not allowed here element resources not allowed here element resource not allowed here
please tell me how configure in pom.xml?
edit
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>3.1</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin>
you didn't copy properly. need use resource plugin , not compiler plugin
<groupid>org.apache.maven.plugins</groupid> <artifactid>maven-resources-plugin</artifactid> <version>2.5</version> <executions>
Comments
Post a Comment