Maven Development Tools/Command Line

Asked at 2017-01-11 16:03:12Z
  • 5 Subscribers
  • 114 Views
1

I'd like to have some tools in my maven project which I can run from inside my IDE (IntelliJ in my case) but which are not packaged with the application. Pretty much just java classes with a main method, similar to the "test" source root but not meant for testing.

Is there any good lightweight method/best practice for achieving this?

An example for such a task would be to reset some test databases, regenerate certain files based on some 3rd party systems etc, so more like scripting tasks having access to the classpath/data model of the module.

Thanks in advance!


1 answers in total

0
leeyuiwah Posted at 2017-01-11 22:31:40Z

For those internal utility programs that I don't plan to distribute, I put them under test (a folder parallel to src) with its own class hierarchy that parallels the one under src. And then in my pom.xml, I just name src as the sourceDirectory. Would this work for your case?

<build>
    <sourceDirectory>src</sourceDirectory>

    <resources>
        <resource>
            <directory>src</directory>
            <includes>
                <include>*.xml</include>
                <include>*.properties</include>
            </includes>
        </resource>
    </resources>
    ...
</build>

P.S. My artifact is a war file. And I use Eclipse not Intellj-idea but for this question I think it does not matter.

Answer this questsion