Maven build generation

Currently trying to pack a small application in such a way that our ops team has a much easier time to deploy it. My requirements are that the projects are compiled and archived.

I run the command "mvn -DmyProfile clean generate-sources package" from the command line, and I created a src.xml file that contains information about where the file should go on top of the declaration of using the zip format for output.

As a result, I get 2 files in my target folder, bank and zip file. The zip file is structured exactly the way I need it, except that my property files were not entered with the correct values ​​from the POM. Instead, all the variables still exist. On the other hand, the bank seems to have entered all the correct values, but the structure of the bank is not the one I need.

This problem occurs only after I tried to add the Java Service Wrapper to my project, and I need the src.xml file to declare where all the new files should be in the project folder structure. Prior to that, the exact same team would work perfectly, and even the jar structure was more aligned with the actual project structure in Eclipse.

Do not blame the Java Service Wrapper device, just wondering if everything that works on this part is trying to create a conflict with the MVN assembly.

Any help is greatly appreciated.

Thanks Yann

+3
source share
2 answers

Ok, so I found the answer to the second problem. The maven command was wrong, I successfully executed:

mvn clean package -P env-prod

And that will put the correct values ​​in the right places in my configuration files. Note the use of the -P switch instead of the -D switch to select a profile.

0
source

, , Maven " ", lib Zip-. - , . , , .

Zip-. , Maven , , .

src.xml, pom.xml:

<assembly>
<id>bin</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
    <format>zip</format>
</formats>
<fileSets>
    <fileSet>
        <directory>src/main/bin</directory>
        <outputDirectory>/bin</outputDirectory>
        <includes>
            <include>**/*.sh</include>
        </includes>
        <fileMode>777</fileMode>
    </fileSet>
    <fileSet>
        <directory>lib</directory>
        <outputDirectory>/lib</outputDirectory>
        <includes>
            <include>**/*.jar</include>
        </includes>
    </fileSet>
    <!-- Wrapper files -->
    <fileSet>
        <directory>lib/wrapper</directory>
        <outputDirectory>/lib</outputDirectory>
        <includes>
            <include>**/*</include>
        </includes>
    </fileSet>
    <fileSet>
        <directory>src/main/bin/wrapper</directory>
        <outputDirectory>/bin/wrapper</outputDirectory>
        <includes>
            <include>**/*</include>
        </includes>
        <fileMode>777</fileMode>
    </fileSet>
    <fileSet>
        <directory>src/main/conf</directory>
        <outputDirectory>conf</outputDirectory>
        <includes>
            <include>**/*</include>
        </includes>
    </fileSet>
</fileSets>
<dependencySets>
    <dependencySet>
        <outputDirectory>/lib</outputDirectory>
        <includes>
            <include>*:jar:*</include>
        </includes>
        <excludes>
            <exclude>*:sources</exclude>
        </excludes>
    </dependencySet>
</dependencySets></assembly>

zip-, zip -, .

... ( , , )

, , , POM.xml. settings.xml, .m2. settings.xml, , :

<activation>
<activeByDefault>false</activeByDefault>
</activation>

, :

mvn -Denv-prod clean generate-sources package

"env-prod" - pom.xml, , .

?

+1

Source: https://habr.com/ru/post/1705886/


All Articles