[英]maven build dependency jar file not reflecting changes in code
I am trying to build a maven project using goal mvn package.When i build the project two jar files get genearted one demo-lwm2m-client-1.0-jar-with-dependencies.jar and the other demo-lwm2m-client-1.0.jar.Now if i do some changes in my a file placed in src/main/resources and build the project again , i find that demo-lwm2m-client-1.0-jar-with-dependencies.jar is not reflecting the changes what i did in code while demo-lwm2m-client-1.0.jar reflects changes.How to reflect my code changes in the dependency jar.Below is the code for my pom.xml. 我正在尝试使用目标mvn软件包构建一个Maven项目。当我构建项目时,生成了两个jar文件,一个是demo-lwm2m-client-1.0-jar-with-dependencies.jar,另一个是demo-lwm2m-client-1.0。现在,如果我对放置在src / main / resources中的文件进行了一些更改并再次构建了项目,我发现demo-lwm2m-client-1.0-jar-with-dependencies.jar无法反映所做的更改在demo-lwm2m-client-1.0.jar反映代码更改的同时做了代码。如何在依赖项jar中反映我的代码更改。以下是我的pom.xml的代码。 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd“> 4.0.0
<groupId>com.demo.lwm2m.client</groupId>
<artifactId>demo-lwm2m-client</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>DemoLwm2mClient</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.leshan</groupId>
<artifactId>leshan-client-cf</artifactId>
<version>1.0.0-M1</version>
</dependency>
<dependency>
<groupId>com.appiot.examples</groupId>
<artifactId>simulatedplatform</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>eclipse</id>
<url>https://repo.eclipse.org/content/repositories/leshan-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>com.demo.lwm2m.MainClass</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Use mvn clean install
. 使用
mvn clean install
。 This will rebuild everything and all changes are included. 这将重建所有内容,并且包括所有更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.