git status shows
modified: target/classes/com/abcplusd/util/JSONUtil$1.class
after clone and import maven project from github repository.
part of Pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<excludes>
<exclude>target/maven-status/maven-compiler-plugin/*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.springframework.build</groupId>
<artifactId>aws-maven</artifactId>
<version>5.0.0.RELEASE</version>
</extension>
</extensions>
</build>
Your problem is that your target folder is located under the folder containing your .git repository. Hence, it appears that Git is viewing changed files from the build process as being something which should be versioned (they should not).
The general solution to this is to change your build target folder to something outside the path which Git manages.
Related
I use tags in my maven POM file to exclude a directory structure I do not want compiled:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<excludes>
<exclude>**/somedir/**</exclude>
</excludes>
</configuration>
</plugin>
However, I would like to have the directory displayed in the STS (3.9.2) Package Explorer. I've tried disabling all view filters, but the excluded directory doesn't display. Is it possible to have maven-excluded directories displayed?
The project itself was created using "Import existing Maven project."
I want to add a generated folder under target directory to build path .
Can I do it in the same pom.xml after I generate the sources.
I tried like below. That didn't help.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.10</version>
<configuration>
<sourceExcludes>
<!-- <sourceExclude>**/.svn/**</sourceExclude> -->
</sourceExcludes>
<sourceIncludes>
<sourceInclude>target/generated-sources/xjc</sourceInclude>
</sourceIncludes>
</configuration>
</plugin>
Please help
I am currently trying to exclude some resource from my built war.
I have read the documentation and the forums, and found a lot of informations.
Unfortunately nothing worked in my case...
I have an Eclipse Maven project, and if I'm right, maven-war-plugin is the default "war builder", so I have to override it in my pom.xml in order to exclude the resource from the buildt war.
I tried warSourceExcludes, packagingExcludes and webResources/excludes :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warSourceExcludes>src/main/webapp/frontEndWorkspace</warSourceExcludes>
<packagingExcludes>src/main/webapp/frontEndWorkspace
</packagingExcludes>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>src/main/webapp</directory>
<!-- the list has a default value of ** -->
<excludes>
<exclude>**/frontEndWorkspace</exclude>
</excludes>
</resource>
</webResources>
</configuration>
</plugin>
Despite this configuration, I still have the frontEndWorkspace directory pushed in my Tomcat...
I wonder if it comes from the fact that I use it in my Eclipse environment?
Thanks in advance!
The parameters that you can use are packagingExcludes which is more generic (applies on the complete war structure) or warSourceExcludes if the files you want to exclude are specifically in the folder defined by the parameter warSourceDirectory (default being ${basedir}/src/main/webapp) (see here). It works easily when you know that it starts considering the folder structure of the war.
Example :
This will exclude all the files finishing by *.jsp contained in the folder WEB-INF of the folder defined by the parameter warSourceDirectory (default being ${basedir}/src/main/webapp) :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warSourceExcludes>WEB-INF/**/*.jsp</warSourceExcludes>
</configuration>
</plugin>
This will exclude all the files contained in all the folders pouet contained in the war (but not the folder structure) :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<packagingExcludes>**/pouet/**/*.*</packagingExcludes>
</configuration>
</plugin>
The problem of your configuration <warSourceExcludes>src/main/webapp/frontEndWorkspace</warSourceExcludes> is that you start from the source folder which is wrong. You just have to remove src/main/webapp and add /** after frontEndWorkspace to have <warSourceExcludes>/frontEndWorkspace/**</warSourceExcludes> working (or <warSourceExcludes>frontEndWorkspace/**</warSourceExcludes>).
I am finding the same issue within Intellij IDEA which is using Maven 3.
The war file it generates contains the directory I am excluding.
UPD
Solution is to use syntax as below to eliminate the myFolder directory
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>src/main/resources</directory>
<excludes>
<exclude>**/myFolder/**</exclude>
</excludes>
</resource>
</webResources>
Here an snippet pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<webappDirectory>C:/Users/Tom/Desktop</webappDirectory>
</configuration>
</plugin>
</plugins>
</build>
It creates the war file to my target folder inside eclipse workspace.
It should put the war folder to my desktop, but it only puts WEB-INF, META-INF folders there. Why?
You should use the outputDirectory option, not the webappDirectory
see http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html
I've migrated to maven 3.0.3 but I'm not able to build the maven site.
In fact my project use an external parent pom that doesn't provide any site descriptor as artifact.
1- Is there a way to generate the maven site even if the parent doesn't provide a site.xml ? I can't make it work. "mvn site" command still crashing trying to download the site.xml of the parent with the following eroor (ArtifactResolutionException: Unable to locate site descriptor...)
2- How do we install or deploy the site.xml on maven repository. I try to add the following xml in my parent pom, but it's not installing anything in my local repo with mvn install command. I've a src/site/site.xml in my project, my project is a pom type project
maven-site-plugin
attach-descriptor
attach-descriptor
UPDATE
No it's not working
In my pom I have
<url>${site_url_pattern}</url>
<distributionManagement>
<site>
<id>test</id>
<url>file://${baseDir}../maven-site</url>
</site>
</distributionManagement>
In plugin management I put
<plugin>
<!-- Site plugin -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<chmod>true</chmod>
<inputEncoding>${encoding}</inputEncoding>
<outputEncoding>${encoding}</outputEncoding>
</configuration>
</plugin>
In plugins I put
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<locales>en</locales>
<reportPlugins>
<!-- Manage site info part creation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin
</artifactId>
<version>2.2</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
<dependencyDetailsEnabled>false</dependencyDetailsEnabled>
<offline>true</offline>
</configuration>
<reports>
<report>cim</report>
<!-- Dependencies report are consuming resources set MAVEN_OPTS=-Xmx1024m if java heap <report>dependencies</report> <report>dependencies-convergence</report> <report>dependencies-management</report> -->
<report>index</report>
<report>issue-tracking</report>
<!-- pb time generation on licence report <report>license</report> -->
<report>mailing-list</report>
<report>plugin-management</report>
<report>project-team</report>
<report>scm</report>
<report>summary</report>
</reports>
</plugin>
</reportPlugins>
</configuration>
<executions>
<execution>
<id>attach-descriptor</id>
<goals>
<goal>attach-descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
I have a src/site/site.xml in the same project
When I do mvn site I still have
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0:si
te (default-site) on project ner-delivery: SiteToolException: The site descripto
r cannot be resolved from the repository: ArtifactResolutionException: Unable to
locate site descriptor: Could not transfer artifact com.sopragroup.evolan:evola
n-framework-superpom:xml:site_en:6.14.2 from/to Artifactory (http://pdtinteg.ptx
.fr.sopra/artifactory/repo): Access denied to: http://pdtinteg.ptx.fr.sopra/arti
factory/repo/com/sopragroup/evolan/evolan-framework-superpom/6.14.2/evolan-frame
work-superpom-6.14.2-site_en.xml
[ERROR] com.sopragroup.evolan:evolan-framework-superpom:xml:6.14.2
If I put manually a evolan-framework-superpom-6.14.2-site_en.xml on my local repo it's working, but that's not a real solution
Explicitly configure maven-site-plugin 3.0 in your pom:
<pluginManagement>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<chmod>true</chmod>
<inputEncoding>UTF-8</inputEncoding>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
</plugin>
</pluginManagement>
Add a url & a distributionManagement element that tell where you plan to deploy it.
Add a src/site/site.xml that contains what you need.
If your parent has none of these, it will work.