I try to start jetty in embedded form but i have problems
I need to read properties values in profile.xml before embedded jetty starts.
Any suggestions ?
Here is profile.xml's content
.....
<profile>
<id>local-dev</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<!-- Common Security Framework Properties -->
<security.context.file>applicationContext-security-csf.xml</security.context.file>
<csf.jndi.name>jdbc/securityDS</csf.jndi.name>
<csf.security.system.admin.roleId>884</csf.security.system.admin.roleId>
<csf.cas.url>tkvwasa01.secure.kodcu.com</csf.cas.url>
<application.service.url>localhost:8080/pqis-admin</application.service.url>
</properties>
</profile>
At maven side i can activate above profile (local-dev) like
mvn jetty:run local-dev
but how can i activate above profile (local-dev) when i use Embedded Jetty ?
Embedded Jetty 's code :
public class Start {
public static void main(String[] args) throws Exception {
Server server = new Server();
SocketConnector connector = new SocketConnector();
// Set some timeout options to make debugging easier.
connector.setMaxIdleTime(1000 * 60 * 60);
connector.setSoLingerTime(-1);
connector.setPort(8080);
server.setConnectors(new Connector[] { connector });
WebAppContext bb = new WebAppContext();
bb.setServer(server);
bb.setContextPath("/");
bb.setWar("src/main/webapp");
.....
}
}
Thanks.
Is this profile active by default? Is another profile active? An active-by-default profile will be disabled if another profile is active.
[edited]
Well, the documentation states that you can activate profiles from the command line using the -P option:
mvn groupId:artifactId:goal -P profile-1,profile-2
But, POM properties are not intended to be used in runtime, but in build time. You could, for example, use these properties to filter resources (XML/.properties config files), replacing placeholder tokens with the properties' values. And then, run the built application.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.