我正在尝试使用目标mvn包来构建maven项目。当我构建项目时,两个jar文件会生成一个demo-lwm2m-client-1.0-jar-with-dependencies .jar和其他demo-lwm2m-client-1.0.jar.Now如果我在src/main/resources文件中做了一些更改并再次构建项目,我发现demo-lwm2m-client-1.0-jar -with-dependencies.jar没有反映我在代码中所做的更改,而demo-lwm2m-client-1.0.jar反映了更改。如何在依赖项jar中反映我的代码更改.Below是我的pom.xml的代码。 http://maven.apache.org/xsd/maven-4.0.0.xsd“> 4.0.0maven build依赖关系jar文件没有反映代码中的变化
<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>
尝试MVN包。 –
我试过了,它不工作要么@SudhaVelan – prem