0

I'm working on this project in my firm and I'm facing this issue on a jenkins deployment pipeline. I have a java component, whose packaging type is pom, and under it I have another java component whose packaging type is ear.

Now when I trigger the jenkins build it throws error

Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare on project : Cannot prepare the release because you have local modifications-
child-component/src/main/application/META-INF/application.xml

The problem is we are changing something in application.xml dynamically based on a version. Hence I don't know how to fix this issue?

I took help from this answer but i wonder if we exclude application.xml from checking modifications whether dynamic changes will be pushed under final packaging or not?

Prateek Gautam
  • 274
  • 2
  • 5
  • 23
  • 1
    "we are changing something in application.xml" => Well ... you shouldn't! – Seelenvirtuose Nov 04 '22 at 11:53
  • 1
    if you are changing something dynamically you should not change in the `src/` area. Then this file should be put into `src/main/resources` and change via resource filtering etc. which will result in a changed file in `target/..` That shows me that your setup in your project is simply wrong... – khmarbaise Nov 04 '22 at 11:55
  • @Seelenvirtuose well I'm just working in this already built project so I'm really not in a position to justify that. But thanks for your response, Also can you elaborate why you said that? – Prateek Gautam Nov 04 '22 at 14:30
  • @khmarbaise why should we not put it src/ area, Can you please explain? Also the apparent solution was that we stopped building the module as it was decommissioned earlier. – Prateek Gautam Nov 04 '22 at 14:32
  • 2
    You should not change code/files which are in `src/` area because they are under version control which exactly is the case here during the release preparation will check if uncommitted files can be located which is exactly what happen here in that case. You can put files into `src/main/resources/META-INF/application.xml` and use the filtering(resources) which will filter those files and write the results into `target/classes/META-INF` location and package them in later life cycle phases. The `target` directory should be ignored always... – khmarbaise Nov 04 '22 at 14:56

0 Answers0