I am trying to use maven-source-plugin to create a source.jar for my kotlin project, but seems the maven-source-plugin not work well for kotlin project.
when i run "mvn source:jar", the output message always says:
[INFO] No sources in project. Archive not created.
here is the maven-source-plugin configuration in my pom file of the project:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<attach>true</attach>
<includes>
<!-- i am trying to specify the include dir manually, but not work -->
<include>${project.basedir}/src/main/kotlin/*</include>
</includes>
<forceCreation>true</forceCreation>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
my question is: how to attach kotlin source files using maven-source-plugin?
thanks ~~
By default maven expects sources to be in src/main/java
directory. If you use non-default directories, you have to specify them in build
element:
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
</build>