سؤال

How can I pass a system variable to my application using the jetty:run command?
Is it possible to pass it like:

mvn jetty:run -Dmy.variable=something

And use it in my code:

String myVariable = System.getProperty("my.variable");
هل كانت مفيدة؟

المحلول

mvn jetty:run -DcommandLineName=value

<plugin>
   <groupId>org.mortbay.jetty</groupId>
   <artifactId>maven-jetty-plugin</artifactId>
   <version>6.1.10</version>
   <configuration>
        <systemProperties>
            <systemProperty>
                <name>arg1</name>
                <value>${commandLineName}</value>
            </systemProperty>
        </systemProperties>
    </configuration>
</plugin>

for more details see this

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top